[Solved] .htaccess 301 and CMSms not correctly working

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
GroeneKaktus
Forum Members
Forum Members
Posts: 46
Joined: Sat Mar 06, 2010 10:38 am

[Solved] .htaccess 301 and CMSms not correctly working

Post 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,.
Last edited by GroeneKaktus on Wed Jun 09, 2010 8:11 pm, edited 1 time in total.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: .htaccess 301 and CMSms not correctly working

Post 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.  :)
GroeneKaktus
Forum Members
Forum Members
Posts: 46
Joined: Sat Mar 06, 2010 10:38 am

Re: .htaccess 301 and CMSms not correctly working

Post 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,.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: .htaccess 301 and CMSms not correctly working

Post by Rolf »

Hi GroeneKaktus,

Try this:

Code: Select all

RewriteRule old-page.html$ http://www.cmsmadesimple.org/new-page [R=301,L]
Regards, Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: .htaccess 301 and CMSms not correctly working

Post by Ted »

Oh, shoot. [L] only works on RewriteRule, not redirect.

Amateurs...  :)
GroeneKaktus
Forum Members
Forum Members
Posts: 46
Joined: Sat Mar 06, 2010 10:38 am

Re: .htaccess 301 and CMSms not correctly working

Post 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
Post Reply

Return to “CMSMS Core”