Php mod_rewrite is not working properly

后端 未结 2 1776
温柔的废话
温柔的废话 2021-01-26 12:36

I\'ve a php page with following link structure:

http://localhost/wisper/businesspage.php?profile=creativeartbd

So I\'m trying to convert this

2条回答
  •  执笔经年
    2021-01-26 13:24

    This ruleset should work for you:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond $1 !^businesspage.php
    RewriteRule ^wisper/(.*?)$ wisper/businesspage.php?profile=$1 [QSA,L]
    

    Please note the RewriteCond in the 6th line: it tells mod_rewrite not to rewrite the wisper/businesspage.php, thus avoiding loops.

提交回复
热议问题