Rewrite URL in PHP with mod_rewrite

前端 未结 3 976
夕颜
夕颜 2021-01-28 16:01

The web server is Apache. I want to rewrite URL so a user won\'t know the actual directory. For example: The original URL:

http://www.example.com         


        
3条回答
  •  深忆病人
    2021-01-28 16:29

    I would suggest the following rule:

    RewriteCond %{HTTP_HOST} ^(?!www)([^.]+)\.mydomainname\.com$ [NC]
    RewriteRule ^(w+)/(\d+)$ /$1/%1/%1.php?%1_id=$2 [L]
    

提交回复
热议问题