jerrrrry
asked on
little .htaccess redirection
The previous answer will result in an infinite loop. It will also remove the file requested from the new URL. Try this instead:
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !^/?fr [NC]
RewriteRule ^/?(.*)$ /fr/$1
# "little" improved :)
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/?fr [NC]
RewriteRule ^/?(.*)$ /fr/$1 [QSA,L]
@routinet, is your REQUEST_FILENAME a typo? (it differs to REQUEST_URI in rare cases)
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/?fr [NC]
RewriteRule ^/?(.*)$ /fr/$1 [QSA,L]
@routinet, is your REQUEST_FILENAME a typo? (it differs to REQUEST_URI in rare cases)
ASKER
how would it work for localhost test?
thanks
thanks
I guess you simply can comment out
# RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
# RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window