Forum Moderators: phranque
Sorry my english is poor :(
Im use apache 2.2.8-r3
I have problem witch double // in my url, and i find a solution but ErrorDocument is doesnt work for double slash after .com
Ex : www.example.com//toto = 404
But i have this message :
Not Found
The requested URL / was not found on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Or my page is 404 but im not view a good page witch ErrorDocument :(
but my config work evrywhere :
Ex : www.example.com/titi//lala = 404 and i view a good page 404
This is my configuration :
ErrorDocument 404 /404
#Rewrite rule
Options +FollowSymLinks
RewriteEngine On
#Remove double slash after .com
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . http://www.example.com%1/%2 [R=404,L]
#remove multiple slashes before URL-path
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ //+([^\ ]*)
RewriteRule .* http://www.example.com/%1 [R=404,L]
If you have any idea about to solve my problem, it would be very nice from your part.
PS : I know, 301 and no problem, but im prefer 404
Your two rules are designed to generate 404 errors, and are not consistent with the comments that precede them. A better approach is to generate a 301 redirect to "correct" the double-slashed URLs:
# Redirect to remove double slash within URL-path
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . http://www.example.com%1/%2 [R=301,L]
#
# Redirect to remove multiple slashes before URL-path
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ //+([^\ ]*)
RewriteRule .* http://www.example.com/%1 [R=301,L]