Mod_rewrite question - silly?

Soldato
Joined
1 Feb 2006
Posts
8,188
Been trying to get some url rewriting done today to make some nice short urls. I have a question on this topic though.

I have set up a redirect to direct from location.php?id= to a nice url like /location/test but what I also want to do is if an old link on my site still points to location.php?id=something can I have this rewritten to the new format?

Currently what happens is this:

I enter address.com/location/test = works

I enter address.com/location.php?id=something works but I want this to move to address.com/location/test.

Is this possible or will url rewriting only work on the new form of the url?

Just cant get my head around this at the moment!
 
I'm not sure what you mean?

The whole point of a rewrite is that /location/test doesn't exist and is rewritten to an actual URL on the server side. The existing URL will always work and has to work or the new one has nothing to be rewritten to if you get what I mean?

You just have to make sure in your code you use the new URLs and also use them when submitting links to people/search engines etc.

Basically your existing links have to be there and have to work, you just never have to use them in that format.

I.e. I have /gig.php?gigID=1 being the correct URL, the rewrite URL is setup to rewrite /gig/1/Some+band+name to that original URL. If that original URL no longer exists where would the rewrite redirect to?
 
I follow you exactly but my question is can I redirect an old format link to the new shorter version instead of updating all my old links?
 
Back
Top Bottom