301 Redirect / Pretty URLs

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.
Locked
BigFishPhilip

301 Redirect / Pretty URLs

Post by BigFishPhilip »

Hello all,

I was able to get Pretty URL's working great.  Can't get the 301 redirects for the old pages to work though.  I've spent the last few hours trying about every possible scenario and can't get it to work.

General consensus is that my .htaccess file should be something like...

Code: Select all

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On

#NEW RULE HERE
RewriteRule ^index\.php\?page=about-us$ http://www.domain.tld/about-us.html

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
...but no love.  Funny thing is that I can get pretty much ANY file EXCEPT index.php to take.  If I test it with index.html instead, then it works fine.

Any thoughts?  I'd really appreciate it. 
Philip
herbshirt
Forum Members
Forum Members
Posts: 145
Joined: Thu Jul 26, 2007 3:47 am

Re: 301 Redirect / Pretty URLs

Post by herbshirt »

You may need to delete index.html from your directory. By default your browser will look for that file before index.php
BigFishPhilip

Re: 301 Redirect / Pretty URLs

Post by BigFishPhilip »

Thanks Herbshirt.  I'd already deleted that file someone along the line already.

Any other ideas anyone?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: 301 Redirect / Pretty URLs

Post by calguy1000 »

herbshirt wrote: You may need to delete index.html from your directory. By default your browser will look for that file before index.php
FYI: that's not a browser issue, that's a server setting.

The server can be directed to be look for
  index.php
  index.whatever
  idx.blah
  index.htm
  index.html

in whatever order depending upon the first one it finds.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
BigFishPhilip

Re: 301 Redirect / Pretty URLs

Post by BigFishPhilip »

Thanks Calguy.

Any ideas on getting the redirect to work?  I'm not having any luck with it at all.
nivekiam

Re: 301 Redirect / Pretty URLs

Post by nivekiam »

This will work, but could be a pain if you have a lot of pages

Redirect 301 /old_page.html http://www.example.com/index.php?page=new-page

Found this, it might help:
http://www.isitebuild.com/301-redirect.htm
BigFishPhilip

Re: 301 Redirect / Pretty URLs

Post by BigFishPhilip »

Hello all,

Thanks to those who helped.  I finally was able to get it to work like this...

Code: Select all

rewriteCond %{query_string} page=about-us
rewriteRule ^index.php /speeding-ticket-focus.html? [R=301,L]
Locked

Return to “CMSMS Core”