0

I would like to re-write (change) the visual appearance of my site URL's, NOT the URL's location or destination.

The current re-write rule doesn't seem to be having any effect on my site URL's.

Current URL:

sell-house-fast/?location=ilford

Desired URL:

sell-house-fast/ilford

Current Code:

RewriteRule ^sell-house-fast/ilford/$ sell-house-fast/?location=ilford [NC,L]

Conclusion:

My URL's are just the same. The code in my .htaccess file hasn't changing a thing.

I'm only guessing, maybe it has something to do with the special characters?

Any ideas/answers would be appreciated.

  • 2
    You need to use the new URLs on your website. So `sell-house-fast/ilford` should be in `href`. Are you doing that? You also might have an issue with the `/`. That should be optional, and you likely want it dynamic. `RewriteRule ^sell-house-fast/(.+)$ sell-house-fast/?location=$1 [NC,L]` – user3783243 Feb 01 '22 at 19:50
  • @user3783243 I'll give that a go. Thanks! – Rubycreative Feb 01 '22 at 20:12
  • @user3783243 That's fixed it. Changing the nav__link href="" to the new desired URL fixed the problem. I had previously managed to get it working this way. Trying to find the bug i created a mess. Thanks! – Rubycreative Feb 01 '22 at 21:16
  • From halfway down [the accepted answer](https://stackoverflow.com/a/20563773/369434) in the [dupe question](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained): `mod_rewrite does not magically make all your URLs "pretty"`. – MrWhite Feb 01 '22 at 22:09

0 Answers0