: Rewrite rule for url that's different than directory structure We have a a site that has a url like such: http://www.example.com/sample Internally on the server the directory structure is like
We have a a site that has a url like such:
www.example.com/sample
Internally on the server the directory structure is like this:
/site-specific/www.example.com/sample
The htaccess looks like this:
RewriteCond %{REQUEST_URI} ^/sample/(.*)$
RewriteRule ^(.*)$ /site-specific/%{HTTP_HOST}/sample
If I visit www.example.com/site-specific/www.example.com/sample I can get to the content. But visiting example.com/sample leads to a 404.
Any ideas?
More posts by @Sims2060225
1 Comments
Sorted by latest first Latest Oldest Best
You can't access /sample because your pattern is expecting /sample/ (with a trailing slash).
However, if you simply want to rewrite from one URL to the other, then all you need is:
RewriteRule ^(sample)$ /site-specific/%{HTTP_HOST}/ [L]
The captured groups (ie. (.*)) in your original code would seem to be unnecessary. (?) The captured group above and the is simply to avoid you having to retype "sample" in the substitution.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.