Forum Moderators: phranque
I have many web page files under a old brand name I need to change without loosing my incoming links to these old pages, is there a way I can do this with my htaccess file using the senario's below so that my renamed files still are found from old links?
3 rewrite senario's I would like to learn
how do I remove part of file name(s) (eliminate oldbrand-)
[domain.com...] to [domain.com...]
how do I replace part of file name(s) (oldbrand- to newbrand-)
[domain.com...] to [domain.com...]
How do I remove part of file name(s) and add directory
[domain.com...] to [domain.com...]
Any help would be appreciated, please provide htaccess text code for each senario above if you can... Thanks To All!
Keith
If it is a case of changing many URLs in exactly the same way, then Mod_Rewrite might be able to help.
If the two names are unrelated, you'll need to rewrite the old requests to an internal script file that then does a database lookup to find the new name, the script then sending the HTTP headers.
So, the question as originally phrased is far too vague to even begin to start coding. The requirements haven't been *fully* and intricately documented.
In any case, we need to see your code. We can help you fix your code, but there are not enough volunteers to provide a free code writing service in this forum.
The basic form of a RewriteRule for redirection is
RewriteRule ^old-url-path$ http://www.example.com/new-url-path [R=301,L]
Jim
Just wondering if I can redirect in the 3 senerio's given to go to
[domain.com...]
[domain.com...] etc...
or
[domain.com...]
[domain.com...] ect...
it's just the oldpage- part that I want to change to many files by renaming or shortening and moving to a folder
RewriteRule ^oldstuff-(.*) http://www.example.com/newstuff-$1 [R=301,L] This redirects
/oldstuff-anything to www.example.com/newstuff-anything It's all about the patterns. Those need to be carefully defined. In many cases using
.* will not be acceptable.