dpdt79577 2017-05-04 15:24
浏览 41
已采纳

使用htaccess配置url

I am trying to change URL with htaccess. I have found similar questions here but they cannot work in my case.

My current url is:

website.com/find-our-office-near-you/index.php?sn=visit-our-office-in-Auburn-36801-Alabama

How i want it to look:

website.com/find-our-office-near-you/Visit-our-Office-in-Auburn-36801-Alabama

  • 写回答

2条回答 默认 最新

  • doubo3384 2017-05-04 15:30
    关注

    You can use the following Rule in .htaccess

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?sn=$1 [L,QSA]
    

    UPDATE Paste the htaccess in the same folder like below

    find-our-office-near-you
        - index.php
        - .htaccess
    

    This will use the url like

    http://localhost/find-our-office-near-you/Visit-our-Office-in-Auburn-36801-Alabama

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?