Forum Moderators: phranque
My URLs look like this:
[domain.com...] (optional query string)
I'm translating the URLs to this format:
[domain.com...]
Here's the relevant portion of my .htaccess file:
Options -Indexes +FollowSymLinks ErrorDocument 400 /html/lang/errors/400.html
ErrorDocument 403 /html/lang/errors/403.html
ErrorDocument 404 /html/lang/errors/404.html
ErrorDocument 500 /html/lang/errors/500.html
ErrorDocument 502 /html/lang/errors/502.html RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST}!^$
RewriteCond %{REQUEST_URI} ^($¦/.*$)
RewriteRule ^.* http://www.domain.com%1 [R=permanent,L] RewriteRule ^html/(eng¦fre)/([A-Za-z0-9]+)(/[A-Za-z0-9]+)?(/[0-9]+)?(\.html)+(\?.*)?$ /html/index.php?lang=$1&cat=$2&page=$3&id=$4&query=$6
Everything seems to be working fine. So what's the problem?
This rewrite rule seems to have disabled ErrorDocuments. Is there something that I'm missing that could be causing this? Or, is there something in my current htaccess file that's preventing ErrorDocument from working? Help!
Thanks in advance!
Welcome to WebmasterWorld!
This line is probably incorrect.
RewriteCond %{REQUEST_URI} ^($¦/.*$)
The same is true for the second RewriteRule. A request for "/html/<lang>/errors/400.html" will be rewritten to "/html/index.php?lang=<lang>&cat=errors&page=400&id=&query="
Your patterns are too ambiguous, or necessary exception cases are not handled.
You should decide exactly which pages you do and do not wish to rewrite, and modify the RewriteConds and RewriteRules as needed.
Jim
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} .
RewriteRule (.*) http://www.example.com/$1 [R=permanent,L]
Jim