Mobile app version of vmapp.org
Login or Join
Sue5673885

: How to make mod_rewrite work transparently? Following is the content of .htaccess file <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase

@Sue5673885

Posted in: #Apache #Linux #ModRewrite

Following is the content of .htaccess file

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+).example.org$ [NC]
RewriteRule ^(.*)$ example.org/%1 [L]
</IfModule>


My purpose is to map all subdomain to folders. For example if a1.example.org is opened it should show the content of example.org/x1. But the URL should not change.

But whenever I open a1.example.org the URL is automatically getting changed. How can I prevent it?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sue5673885

2 Comments

Sorted by latest first Latest Oldest Best

 

@Kaufman445

It sounds like you want a reverse proxy. Fortunately, there's a flag to do this.

So you need to enable mod_proxy and add P to the RewriteRule flags.

10% popularity Vote Up Vote Down


 

@Chiappetta492

You can't use absolute URLs

RewriteCond %{HTTP_HOST} ^(.+).example.org$ [NC]
RewriteRule ^(.*)$ /%1 [L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme