Page 1 of 1

[Solved] .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 10:43 am
by GroeneKaktus
Dear devs,

I have a question regarding 301 redirecting via .htaccess.

I use the following code for redirecting a few (indexed static .html) pages to pages in my new CMSms website.

Code: Select all

 redirect 301 /examplepage.html http://www.examplewebsite.nl/examplepage/ 
When I check if the redirect works correctly, it redirects to:
http://www.examplewebsite.nl/examplepag ... epage.html ???

How is this possible? Has it maybe to do with the following lines in .htaccess?

Code: Select all

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

I really appreciate any possible help in how to redirect my old static html pages to the new cmsms pages, otherwise I loose a bunch of indexed pages with pagerank.
I'm using CMSMS 1.7.1

Thanks in advance,


Regards,

Jeroen,.

Re: .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 11:31 am
by Ted
Try:

Code: Select all

redirect 301 /examplepage.html http://www.examplewebsite.nl/examplepage/ [L]
The L (for Last) tells the .htaccess file to stop processing.  Then, the redirect creates a new connection, which follows the normal rules of the file.

Hopefully that makes sense.  :)

Re: .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 12:05 pm
by GroeneKaktus
Ted wrote: Try:

Code: Select all

redirect 301 /examplepage.html http://www.examplewebsite.nl/examplepage/ [L]
The L (for Last) tells the .htaccess file to stop processing.  Then, the redirect creates a new connection, which follows the normal rules of the file.

Hopefully that makes sense.  :)
Dear Ted,

thanks for your reply, but it unfortunately doesn't work, I get an Internal Server Error when I add [L] behind the code.

Is this a CMSms related problem? I never had problems with 301 redirects via .htaccess before.   :(

Regards Jeroen,.

Re: .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 5:31 pm
by Rolf
Hi GroeneKaktus,

Try this:

Code: Select all

RewriteRule old-page.html$ http://www.cmsmadesimple.org/new-page [R=301,L]
Regards, Rolf

Re: .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 7:29 pm
by Ted
Oh, shoot. [L] only works on RewriteRule, not redirect.

Amateurs...  :)

Re: .htaccess 301 and CMSms not correctly working

Posted: Wed Jun 09, 2010 8:10 pm
by GroeneKaktus
Rolf wrote: Hi GroeneKaktus,

Try this:

Code: Select all

RewriteRule old-page.html$ http://www.cmsmadesimple.org/new-page [R=301,L]
Regards, Rolf

Rolf,

This is working great! :D
I had to change the code a little bit

Code: Select all

RewriteRule ^old-page.html$ http://www.cmsmadesimple.org/new-page [R=301,L]
for it to work properly.

Thank you so much.

Groeten Jeroen