$_GET URL ReWriting

前端 未结 1 1527
余生分开走
余生分开走 2021-01-25 17:45

Hey everyone. Hopefully I can explain this correctly.

I have some URL\'s which I would like to tidy up through URL reWriting. For instance, I have:

domai         


        
相关标签:
1条回答
  • 2021-01-25 17:50

    Add this to your .htaccess file:

    RewriteEngine On
    RewriteRule ^page/(\d+)/?$ /index.php?page=$1 [L]
    

    The GET queries will always be executed. If the user types in domain.com/index.php?page=3, then index.php will run. If they type in domain.com/page/3, then mod_rewrite will convert it to domain.com/index.php?page=3 before passing it to PHP. Either way, index.php is run.

    0 讨论(0)
提交回复
热议问题