Hello,
I am using EVO 1.06 to replace an existing website.
I have simplifed / changed the URL structure for the new MODx pages using friendly URLs and am wanting to use htaccess 301 redirects to redirect the old pages to the new MODx pages.
Not sure if this makes it any easier, but all the pages on the old site were preceded with /pages/ -
eg domain.com.au/pages/products/sunscreens.php
I am not having any success with the redirects I have tried, except where redirecting to the MODx resource ID.
Redirecting to the MODx resource ID does work but is not ideal and I would really like to redirect to friendly URLs to avoid duplicate content and user confusion / statistics confusion
redirect 301 /pages/products/sunscreens.php http://www.domain.com.au/index.php?id=178
I searched the forum and found some methods that had worked for other users but unfortunately for me these all throw either internal server errors or the 404 error page.
I have tried the following methods above the standard MODx FURLS code:
RewriteRule ^/pages/products/sunscreens\.php$ <a href="http://www.domain.com.au/products/sunscreens" target="_blank" rel="nofollow">http://www.domain.com.au/products/sunscreens</a> [L,NC,R=301]
but this throws an internal server error.
and
RewriteRule /pages/products/sunscreens.php$ http://www.domain.com.au/products/sunscreens [R=301,L]
this returns 404 error page with the address: http://www.domain.com.au/products/sunscreens?q=pages/products/sunscreens.php
and
RewriteRule /pages/products/sunscreens.php http://www.domain.com.au/products/sunscreens [L,NC,R=301]
this returns 404 error page with the address: http://www.domain.com.au/products/sunscreens?q=pages/products/sunscreens.php
and
RewriteRule ^/pages/products/sunscreens\.php$ http://www.domain.com.au/products/sunscreens [L,NC,R=301]
this does work but somehow only to the MODx resource ID:
redirect 301 /pages/products/sunscreens.php http://www.domain.com.au/index.php?id=178
My htaccess currently looks like this (with the redirects currently commented out):
#prevent viewing of htaccess file
<FILES .htaccess>
order allow,deny
deny from all
</FILES>
ServerSignature Off
Options -Indexes +FollowSymlinks
RewriteEngine on
RewriteBase /
#rewrite URLs to make Search Engine Friendly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
#redirect non www to www to prevent duplicate content in search engines
RewriteCond %{HTTP_HOST} !^www\.domain\.com.au$
RewriteRule ^(.*)$ http://www.domain.com.au/$1 [R=301]
#fix Apache internal dummy connections from breaking [(site_url)] cache
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]
#exclude /assets and /manager directories and images from rewrite rules
RewriteRule ^(manager|assets)/*$ - [L]
RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]
#prevent hotlinking of images etc
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com.au/.*$ [NC]
RewriteRule \.(gif|jpe?g|png|mov|avi|wmv|mpe?g)$ - [F]
#protect site against HTTP tracking and tracing
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* – [F]
#block access from libwww-perl blocking urls that include http
RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)=http: [NC]
RewriteRule ^(.*)$ - [F,L]
Any ideas.
Any help greatly appreciated.
Thanks in advance.
[ed. note: nickf08 last edited this post 14 years, 4 months ago.]