2

I have a query URL with query string and I want to convert it to folder structured URL.

For example:

http://localhost/index.php?page=about-us
http://localhost/index.php?page=contact-us

how would I covert it to

http://localhost/index/page/about-us
http://localhost/page/about-us

I know this can be done with .htaccess. I just don't know where to start

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
Grigor
  • 4,139
  • 10
  • 41
  • 79

1 Answers1

1

You would need something along the lines of...

Options +FollowSymLinks   
RewriteEngine On   

RewriteCond %{SCRIPT_FILENAME} !-d   
RewriteCond %{SCRIPT_FILENAME} !-f   

RewriteRule ^page/([-a-z-0-9]+)*/$ ./index.php?page=$1
RewriteRule ^index/page/([-a-z-0-9]+)*/$ ./index.php?page=$1
swenflea
  • 562
  • 1
  • 5
  • 14