Forum Moderators: phranque
I have little problem :
http://www.example.com/?
http://www.example.com/toto/?
http://www.example.com/toto/abc/?
http://www.example.com/toto/abc/ect/?
Im search solution for remove ? in my url but i have one exception and is for one subdomains
http://www.example.com/forums/index.php?t=msg&goto=12368&#msg_12368
Under /forums/ ? is allow
I try many test, but nothing work. Do you have any idea ?
Bye
I try this :
RewriteRule ^(([^/]+/)*[^.]*)\?$ http://www.example.com.com/$1 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/$1 -f
RewriteRule ^(([^/]+/)*[^.]*)\?$ http://www.example.com.com/$1 [R=301,L]
#
RewriteCond %{DOCUMENT_ROOT}/$1/ -d
RewriteRule ^(([^/]+/)*[^.]*)\?/?$ http://www.example.com.com/$1/ [R=301,L]
If im replace ? by - the code is work :(
So, in order to detect a question mark with either a blank or a non-blank query string, you have to examine %{THE_REQUEST}:
# Remove trailing query strings from all URL-paths ending in "/"
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^?]*\?
RewriteRule ^(([^/]+/)*)$ http://www.example.com/$1? [R=301,L]
Jim
[edited by: jdMorgan at 2:33 am (utc) on Jan. 3, 2009]
Did you flush your browser cache before testing?
Did you read the comments, and test with a URL ending in a slash, as described previously?
If you want further help, then please tell us how you tested, tell us what you expected, and tell us what actually happened.
Jim
I flush my cache of my browser allways time before test.
This is my .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^?]*\?
RewriteRule ^(([^/]+/)*)$ http://www.example.com/$1? [R=301,L]
When i try :
http://www.example.com/?
http://www.example.com/toto/?
http://www.example.com/toto/abc/?
http://www.example.com/toto/abc/ect/?
The code of return is 200, not 301.
Im search when i have this url :
http://www.example.com/?
is return 301 to
http://www.example.com/
Thanks,