For example, there's a domain1.tld and synonym domain2.tld. If you request the address in the browser http://domain2.tld/dir/

with a slash at the end, then the index page from the dir directory of the main domain will be displayed, while the contents of the browser address bar will remain unchanged. But if you request http://domain2.tld/dir without a trailing slash, a redirect will occur to http://domain1.tld/dir/, and the contents of the address bar will change accordingly.

This is a feature of the mod dir module, in which if a request is made for a file that is a directory, but the request does not end with a slash, then mod_dir performs an external redirect to the same address with a slash at the end. In the case of a synonym, the domain name is also replaced during redirection. If you are not happy with this web server behavior, add the following lines to your .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !^domain2.tld$
RewriteRule ^(.+[^/])$ http://domain2.tld/$1/ [R]
Var dette svaret til hjelp? 26 brukere syntes dette svaret var til hjelp (91 Stemmer)