redirect old URL to newser one

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
testuser
Forum Members
Forum Members
Posts: 34
Joined: Thu Sep 30, 2010 3:40 pm

redirect old URL to newser one

Post by testuser »

Hi,

I´m using CMSMS with mod_rewrite (rewrite to ;http://www.domain.com/parent/page/.

Now, I have a few old pages indexed and I want to redirect them to newer version.

I´m using this .htaccess file:

Code: Select all

RewriteEngine on

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
<FilesMatch "\.(ttf|otf|eot)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

<FilesMatch "\.(jpg|jpeg|png|gif|swf|css|js)$">
    Header set Expires: "Thu, 15 Apr 2050 20:00:00 GMT"
</FilesMatch>

RewriteBase /

RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$
RewriteRule ^(.+[^/])$ /$1/ [R=301,L]

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,QSA,L]

RewriteCond %{QUERY_STRING} http\: [OR]
RewriteCond %{QUERY_STRING} \[ [OR]
RewriteCond %{QUERY_STRING} \] [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
and need somewhere add this redirect from ;http://www.domain.com/old-page to ;http://www.domain.com/new-page.

I´m not experienced in .htaccess, so I tried more options, with no effect.

Thanks for hints!
Last edited by Dr.CSS on Mon Dec 30, 2013 6:56 pm, edited 1 time in total.
Reason: Please use double quotes or something on fake links so they aren't clickable...
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: redirect old URL to newser one

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Modules/Add-Ons”