: 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
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?
More posts by @Sue5673885
2 Comments
Sorted by latest first Latest Oldest Best
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.
You can't use absolute URLs
RewriteCond %{HTTP_HOST} ^(.+).example.org$ [NC]
RewriteRule ^(.*)$ /%1 [L]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.