homepage Welcome to WebmasterWorld Guest from 54.211.100.183
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

    
Old page use underscores, but CMS only supports hyphens
Will a 301 redirect handle this?
fom2001uk

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4670682 posted 10:02 am on May 13, 2014 (gmt 0)

I want to preserve an old page on a site (long deleted) for link value, but the filename uses underscores. The page can be re-created but only with hyphens (underscores are not supported in the CMS). Will a 301 redirect solve this or not?

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4670682 posted 7:31 pm on May 13, 2014 (gmt 0)

Yes, a redirect can be done for any URL. Since it's just one page, spell out the complete old name on the "pattern" side of the redirect, and the complete new name on the "target" side.

You don't identify your CMS, but if it's any of the big names, it relies heavily on mod_rewrite. So your new redirect needs to go in htaccess before the built-in RewriteRules.

ergophobe

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4670682 posted 7:11 pm on May 15, 2014 (gmt 0)

This might be a better job for a rewrite rather than a redirect.

A rewrite will mean the URL looks the same in the user's address bar as it always did. Since your CMS is probably using rewrites already as Lucy said, you just add one.

Let's say your page is

example.com/my_great_page

The CMS will let you create
example.com/my-great-page

But in an case, it's rewriting this to

example.com/index.php/p=my-great-page

So you could

redirect my-great-page to my_great_page

then rewrite my_great_page to index.php/p=my-great-page

That shouldn't cause an infinite loop. The key question is whether you can control the output of the link to that page. If your CMS is going to force you to show links with underscores, you could have a duplicate content problem. But if you can manually create the link, the above should work and still preserve the original URL.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved