I have rewrite rule that works okay, but ends up changing the visible URL if a trailing slash is omitted when going to an index.php
:
RewriteEngine on
RewriteCond %{REQUEST_URI} !main
RewriteRule /.* /~user/main$0
When someone visits
http://user.dev.example.com/utilities/pib/
The page works fine. However, if they visit
http://user.dev.example.com/utilities/pib
They are redirected to
http://user.dev.example.com/~user/main/utilities/pib/
This still works fine, but I'd rather have the URL not change. The server has other configuration that allows for ~user
in the URL to take you to public_html
on the disc (where these files are located). So the actual URL should be:
http://dev.example.com/~user/main/utilities/pib/
But it still leaves my name in the domain. I'm not sure if I am even able to solve this problem, but I'm also not sure what other configuration could cause it.
You can always use mod_rewrite to append a trailing slash
Add it above your first rule
The above rules is not the cause of it. Check all the included configuration files in
conf.d
(or similar). If you setAllowOverride All
, find all the.htaccess
files with:and take a look at that.
I also suggest you turning on the
mod_rewrite
log:to see how the URI is parsed.