简体   繁体   中英

Using .htaccess to turn /index.php?page=X to /X

I've got a website that I've written from scratch, and the URL system is /index.php?page=X . I really want to be able to just type /X to get to that page. I've tried many ways I've seen on the Internet (over 10), and I can't find a way that works.

Also, I want to be able to do /X instead /index.php?page=X&page2=X (if they were all different variables)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(\d+)$  index.php?page=$1
RewriteRule  ^(\d+)\/to\/(\d+)$  index.php?page=$1&page2=$2

</IfModule>

I did not understand second part! I you can please explain!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM