0

I hope you can help me. I'm trying to create a URL rewrite, redirect, or combination of the two in a .htaccess file, but I don't know how. It's kinda hard to find anything definitive on URL rewrites.

Basically, I want the user to be able to type in a SEO friendly URL (just one level) and have that sent to a page where I can do a $_GET['data'] and do a mysql query and serve up a web page. I don't want the URL the user sees to change though so I'm not sure if I need to redirect it back to the SEO friendly or if it can just stay the same SEO friendly version.

Here's my example:

The user would type in this URL: www.mysite.com/cars

somehow, that would be either redirected or rewritten as: www.mysite.com/getpage.php?page=cars

but the URL stays the same: www.mysite.com/cars

I'm pretty sure this is a URL rewrite or redirect or a combination of the two but I have no idea how to write the rewrite rules. I

Any assistance you can offer would be extremely helpful!

Thanks Keyogee

keyogee
  • 13
  • 3
  • What you're after is called a rewrite, ie the URL is re-written (internally) to one your app can make sense of. There are a lot of examples of this online so what have you found and tried out? – Phil Oct 30 '20 at 00:25
  • Here's a very basic example ~ https://htaccess.madewithlove.be?share=04f88f24-4f69-4765-93aa-d849ffbea86c – Phil Oct 30 '20 at 00:28
  • From the duplicate, I like [this answer](https://stackoverflow.com/a/28169287/283366) the best – Phil Oct 30 '20 at 00:30
  • 1
    Phil, thanks SOOO much for the example you shared. That's EXACTLY what I needed. – keyogee Oct 30 '20 at 03:56

0 Answers0