Forum Moderators: phranque
#Redirect to remove query string from any directory-paths
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteRule ^(.*)$ http://www.#*$!.com/$1? [R=301,L] RewriteEngine on
# www redirect
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
#remove phpsession
<IfModule mod_rewrite.c>
#remove PHPSESSID
RewriteCond %{QUERY_STRING} PHPSESSID=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]
</IfModule>
# Capture glcid parameter and remove all preceding (and following)
# parameters when glcid is present in middle or at end of parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} &glcid=([^&]+)
RewriteRule (.*) http://www.example.com/$1?glcid=%1 [R=301,L]
# Capture glcid parameter and remove all following parameters
# when glcid is present as first parameter of multiple parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} ^glcid=([^&]+)&
RewriteRule (.*) http://www.example.com/$1?glcid=%1 [R=301,L]
# Remove all parameters except when glcid is present.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} !glcid=
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
# Canonical redirect.
RewriteCond %{HTTP_HOST} ^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
RewriteRule ^computer-repair/(.+)\.html$ /region.php?regio=$1
ErrorDocument 404 /errors/404.php
# Canonical redirect.
RewriteCond %{HTTP_HOST} ^(www\.example\.com)?$ ! immediately before the ^ here. [L] flag on the end. Your rewrite is missing it.
RewriteEngine on
# Capture gclid parameter and remove all preceding (and following)
# parameters when gclid is present in middle or at end of parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} &gclid=([^&]+)
RewriteRule (.*) http://www.example.com/$1?gclid=%1 [R=301,L]
# Capture gclid parameter and remove all following parameters
# when gclid is present as first parameter of multiple parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} ^gclid=([^&]+)&
RewriteRule (.*) http://www.example.com/$1?gclid=%1 [R=301,L]
# Remove all parameters except when gclid is present.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} !gclid=
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
# Canonical redirect.
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
RewriteRule ^computer-repair/(.+)\.html$ /region.php?regio=$1
ErrorDocument 404 /errors/404.php
# Index redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
RewriteRule ^computer-repair/(.+)\.html$ /region.php?regio=$1right?
http://www.example.com/region.php [edited by: g1smd at 3:58 pm (utc) on Aug 2, 2011]
RewriteEngine on
# Capture gclid parameter and remove all preceding (and following)
# parameters when gclid is present in middle or at end of parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} &gclid=([^&]+)
RewriteRule (.*) http://www.example.com/$1?gclid=%1 [R=301,L]
# Capture gclid parameter and remove all following parameters
# when gclid is present as first parameter of multiple parameters.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} ^gclid=([^&]+)&
RewriteRule (.*) http://www.example.com/$1?gclid=%1 [R=301,L]
# Remove all parameters except when gclid is present.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?#\ ]*)\?[^\ ]*\ HTTP/
RewriteCond $1 !^stats/
RewriteCond %{QUERY_STRING} !gclid=
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
# Canonical redirect.
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
RewriteRule ^computer-repair/(.+)\.html$ /region.php?regio=$1 [L]
ErrorDocument 404 /errors/404.php
When i go to www.example.com/computer-repair/region1-region2-region3.html?gclid=COb1wftMpogSWQJPQgodwXk53 it redirects to http://www.example.nl/region.php
Redirect 301 /old/old.html [examle.nl...]
The redirect to region.php only happens when i add the "gclid" thing.
It should have something to do withRewriteRule ^computer-repair/(.+)\.html$ /region.php?regio=$1 [L]right? Anyway, there is no other .htaccess in a subfolder. I also did not really find a php thing that is causing the page to go to /region.php...
Any ideas?
RewriteRule /old/old.html http://www.example.com/new/new.html [R=301,L]?