Forum Moderators: phranque

Message Too Old, No Replies

How to Replace a word in url Structure ?

         

studee

7:34 pm on Mar 22, 2009 (gmt 0)

10+ Year Member



Hi !

I want to change the url structure in this fashion

current url

http://example.com/old/page.html

new url ( what i want )

http://example.com/new/page.html

can anyone help me with this ?

Dee

g1smd

8:14 pm on Mar 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are the pages moving location inside the server, or are they staying in the same place?

If they are moving, do you want to carry on using the old URLs for the new internal location of the file?

Whether they are moving or not, do you want to have new URLs for your pages? You don't have to have new URLs.

There's two solutions. One involves redirects, the other involves rewrites.

Which you need depends on what you actually want to do.

Be very clear as to the differences between a redirect and a rewrite and what each one can actually do for you.

If you insist that you need new URLs, then you will need to link to the new URLs from the pages of your site. It is 'links' that define URLs. You will also need to redirect requests for old URLs so that browsers are forced to make a new request for the new URLs.

Hopefully you now understand that you might not have to have new URLs at all...

studee

4:54 am on Mar 25, 2009 (gmt 0)

10+ Year Member



hi g1smd!

Thanks for explaining this my problem is i am using joomla and some how one component (joomla related) is making duplicate urls with two names
like my example above.

i think my writing old and new confused you a bit it must be rather

current url ( what i want to retain )

http://example.com/tag1/page.html

duplicate url

http://example.com/tag2/page.html

i think what i want is a Mod Rewrite ( if i am not wrong) i think a .htaccess line will do it , or may be alias its just that i know very little about these things. so i am looking if someone can suggest me a solution for this ....

Dee

g1smd

8:49 am on Mar 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** making duplicate urls with two names ***

URLs are defined by links. Therefore the best solution is to modify the link generation script to write out the 'correct' URL in the link.

Whether you do that or not, you should also redirect requests for one URL type over to the other type. You can do this without doing step one, above, but it is very bad form for internal navigation clicks to pass through a redirect when navigating round a site. The main reason for the redirect is to force usage of the new URL for anyone that has stored the old URL in bookmarks, as a link from another site, or in a searchengine index, etc.