Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite & into &

is it possible to use mod_rewrite to change & into &

         

cotc

5:30 pm on Mar 14, 2006 (gmt 0)

10+ Year Member



Does anyone know if it is possible to use mod_rewrite to change the & symbol in URLS into &

Why do i want to do that I hear you ask?

Well im just playing around with the tidy validator extension for firefox and of course any links with & instead of & are coming up as a warning - so rather than go through all the code and change them over manually , i wondered if there was a cheap and cheerfull way of using mod_rewrite to just do it automatically.

If anyone knows the answer and synatx it would be appreciated.

jdMorgan

8:23 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



An ampersand is not a valid character for use within a URL [faqs.org]. You may use it within a query string appended to a URL, but not within the URL itself. If you want a robust solution, then get rid of the ampersands in the URL entirely.

mod_rewrite cannot change the URLs on your pages. It can only do an external redirect or an internal rewrite. External redirects tell the client to re-request the desired content at a new URL, while internal rewrites change the filename associated with a requested URL. If you want to change the links on your pages, then modify the pages themselves, or the script that you use to generate them dynamically.

Jim