views:

50

answers:

1

1- Does mod_rewrite means that if I make this url:

  domain.com/ad.php?id=8498292

INTO

  domain.com/8498292

that all links on my website will have to be changed to the later above?

example the link: domain.com/ad.php?id=8498292 wont work now, unless I replace it with domain.com/8498292 ? Or will the server know that they are the same still?

2- Will the rewritten link appear rewritten in the browsers adress bars also, so if I enter domain.com/ad.php?id=8498292 it will actually appear as domain.com/8498292 in the adress bar itself?

3- Will images and all other related links and material on the page whose link is rewritten remain intact? ie will pictures and links still work FROM that page which are relative?

Thanks

+1  A: 
  1. You can write the rules such that both will work, but generally you'll want the links to be in the "clean" format for when search engines index your pages.

  2. mod_rewrite can do an internal rewrite if the pages are on the same domain. One would have to use the [R] flag to force an external redirect if that was desired.

  3. You can make the rules as expansive or as restricted as necessary in order to avoid rewriting media URLs. RewriteCond has a number of ways to test the viability of rewriting.

Ignacio Vazquez-Abrams
Thanks for the answer, could you clarify nr 2 for me a little bit more?
Camran
The end of the mod_rewrite docs give examples for the `[R]` and `[P]` tags. When it says "via external redirection" is when the URL in the browser's location bar changes. Otherwise they see it exactly as entered. http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
Ignacio Vazquez-Abrams