Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename files, No 301 Redirects, What is the Best way to do this?

Status
Not open for further replies.

IEAN

Programmer
Sep 13, 2003
122
US
Hi all,

We have created a new set of pages to replace the old set currently existing on our site. We would like to change the file directory name, file name of the pages too. Generally what normally should be done is to set a 301 server redirect to direct the old pages to the new, but the problems is, my hosting company says they cannot set the redirect because the old urls have "_" in them. I wouldn't want to put a regular html redirect in them since they may hurt my exsiting rankings(right?). I wouldn't want to put a static link for my customers to click on everytime they come upon an old page either. Any ideas on what I should do? Please advise, thanks!
 
Which webserver are you using? Apache? IIS?

What's the name of the hosting company?
I'm not aware that having an underscore in a filename would prevent setting up a redirect... not under Apache anyway.

If you are using Apache and can use .htaccess files try adding the following

Code:
Options +All
RewriteEngine On

RewriteRule ^old\_file\_name.html$ newFileName.html[QSA,L]
RewriteRule ^old\_file\_name2.html$ newFileName2.html[QSA,L]


The '\' symbols are 'escaping' the underscores so they don't get treated as part of a regular expression.

I think the above will work. Not got time to test it right now, but why not give it a go.
Note: this will only work on an Apache Server and even then only if your hosting allows for .htaccess files and ModRewrite.

If you have a large number of pages then it may be possible to create a regular expression to redirect all the old pages to the new pages.


Another option would be to create old pages and use a server side language to issue a 301 redirect if they are called. Your problem then though is that they would need to be PHP or ASP (or CFM) pages to start with.

The final course of action is to create old pages with a Meta redirect in them. This will work regardless, but is a little clumsy really.

I'd keep on at the hosting company if I were you. Ask them to explain why a "_" prevents doing a 301 redirect.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top