[Solved] Pretty Urls won't let me redirect.

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
bazzlad
Forum Members
Forum Members
Posts: 20
Joined: Tue May 29, 2007 7:12 pm

[Solved] Pretty Urls won't let me redirect.

Post by bazzlad »

Hey all, quick question but it's been driving me nuts.

I've got pretty urls set up on my cmsms site like below:

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

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

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+).htm$ index.php?page=$1 [QSA] 

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

It works fine (most of the time!)

However...
I want to 301 redirect a page say it's called bigbear.htm

When I add this to my .htacess

Code: Select all

redirect 301 /bigbear.htm http://www.site.com/index.htm

It takes me to
www.site.com/index.htm?page=bigbear.htm

Which is actually worse than it was before!

What am I doing wrong?

NB - Doesn't matter what variant I redirect the page to, it happens the same...
Last edited by bazzlad on Fri Nov 28, 2008 8:55 am, edited 1 time in total.
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm

Re: Pretty Urls won't let me redirect.

Post by Nick Smart »

Try this:

Code: Select all

[...]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^bigbear.htm$ http://www.site.com/index.html  [R=301,L]
RewriteRule ^(.+).htm$ index.php?page=$1 [QSA] 
[...]


Nick
Last edited by Anonymous on Thu Nov 27, 2008 4:25 pm, edited 1 time in total.
bazzlad
Forum Members
Forum Members
Posts: 20
Joined: Tue May 29, 2007 7:12 pm

Re: Pretty Urls won't let me redirect.

Post by bazzlad »

Legend!

Thanks a lot mate!
Pierre M.

Re: [Solved] Pretty Urls won't let me redirect.

Post by Pierre M. »

Hello,
bazzlad wrote: I want to 301 redirect a page say it's called bigbear.htm

Code: Select all

redirect 301 /bigbear.htm http://www.site.com/index.htm
Please keep on topic, this is not CMSms specific.
The webserver guide tells that redirect/rewrite directives order matters.

BTW, don't show commented out lines when requesting support. We can misread them.

Pierre M.
bazzlad
Forum Members
Forum Members
Posts: 20
Joined: Tue May 29, 2007 7:12 pm

Re: [Solved] Pretty Urls won't let me redirect.

Post by bazzlad »

Whoa there Pierre!
I apologise for posting this in the wrong place, but in my defence my old 301 redirects worked fine before I installed CMSMS, and used that - which is the recommended .htaccess file for pretty urls, thus I presumed it was a CMSMS issue, an easy mistake to make for somebody following logic who doesn't have a lot of experience using .htaccess.

Also, I left the comments in the code post because that's exactly how it's written on the wiki page, so I wanted to show that it was the generic one recommended.

Again apologies for any ballsup, but I'm sure you can see where I was confused.
Pierre M.

Re: [Solved] Pretty Urls won't let me redirect.

Post by Pierre M. »

Thank you, I make mistakes too, obviously.
Have fun with CMSms
Pierre
Post Reply

Return to “CMSMS Core”