0

I cannot for the life of me get this to work. I'm using this tutorial to make clean URLs: http://www.desiquintans.com/cleanurls.

So I have my domain, example.com, which is hosted using GoDaddy under the "Linux with cPanel control panel" plan. I uploaded a blank file called index.php. In the same folder, I uploaded .htaccess with this code:

RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1

When I type example.com/index.php?page=blahblahblah, the URL doesn't change to example.com/blahblahblah like it should. It doesn't change at all.

I've tried it on MAMP and it didn't work either. I tried changing the httpd.conf file for MAMP as well, but that didn't do anything.

I just need some pretty URLs, even if I have to manually say, "index.php?id=12344545 [goes to] example.com/mysubpage" for each individual page.

How can I achieve pretty URLs using .htaccess?

EDIT: I wasn't actually doing anything wrong with the .htaccess file, I just misunderstood a crucial concept pointed out my @Rasclatt:

"You have to change your links, not reformat what's in your address bar".

I just need to change my site's hyperlinks to the pretty URLs.

AnnaBlabber
  • 432
  • 1
  • 7
  • 20
  • 1
    Have you tried the other way around? ie. type in `example.com/blahblahblah` and see if it resolves to `index.php?page=blahblahblah`? If it does, you just change all your links from a query link to a normal SEO link and it would resolve to the correct query. – Rasclatt Oct 23 '14 at 03:30
  • 1
    mod_rewrite works on matching **incoming** URLs. It does not redirect by itself, or rewrite links in HTML templates. Secondary redirection RewriteRules are often used as *workaround* – mario Oct 23 '14 at 03:31
  • 1
    Or [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/q/20563772) and [How do I redirect old ugly ulrs to nice urls](http://stackoverflow.com/q/16201609) – mario Oct 23 '14 at 03:33
  • @Rasclatt yep, it does! Okay, I see. What do you mean, change all my links from a query link to a normal SEO link? EDIT: You mean change all my site's hyperlinks to the pretty SEO-friendly links? – AnnaBlabber Oct 23 '14 at 03:34
  • 1
    Yes, I was stuck on this concept for a very long time...until one day I just changed the link to see if it would work in reverse, and voila! You have to change your links, not reformat what's in your address bar – Rasclatt Oct 23 '14 at 03:36
  • 1
    Thanks @Rasclatt! I finally get it. And thanks @mario for the references! – AnnaBlabber Oct 23 '14 at 03:37

0 Answers0