Page 1 of 1

[solved] what on earth is going on with my redirects?

Posted: Wed May 02, 2012 5:47 pm
by ladyr0gue
Hi I've just dragged my cmsms install over to the live server and set it all up, it all works great except
I had some redirects that were working fine and now they aren't...
this is my htaccess file

Code: Select all

<Files "config.php">
order allow,deny
deny from all
</Files>
# Sets your error documents
# not absolutely essential to have, 
# or you may already have error pages defined elsewhere
ErrorDocument 500 /error-500.html
ErrorDocument 401 /error-401.html
ErrorDocument 403 /error-403.html

# No sense advertising what we are running
ServerSignature Off

# END Optional Settings

# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine on

# Might be needed in a subdirectory
#RewriteBase /



# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# except for form POSTS
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]


# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
RewriteRule ^.*$ - [F,L] 
# END Filtering

# CMSMS Rewriting

# Rewriting old pages to new
RewriteRule ^contact.php$ contact.html [R=301,L]
RewriteRule ^thanks.php$ thanks.html [R=301,L]
RewriteRule ^sitemap.htm$ welcome.html [R=301,L]


# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS

well.. they get me where I want to go - but if I type in contact.php for example the url is "http://www.example.com/vhome_test/19/4 ... ntact.html
what the hey???

Re: what on earth is going on with my redirects?

Posted: Wed May 02, 2012 6:15 pm
by Rolf
After the move, did you change all paths in the config.php?

Clear cache?

Perhaps try:

Code: Select all

RewriteRule ^contact.php$ http://www.website.com/contact.html [R=301,L]
grtz. Rolf

Re: what on earth is going on with my redirects?

Posted: Wed May 02, 2012 6:59 pm
by ladyr0gue
Rolf wrote:
Perhaps try:

Code: Select all

RewriteRule ^contact.php$ http://www.website.com/contact.html [R=301,L]
grtz. Rolf
and that was it, thank you Rolf :)