.htaccess url:重写在本地主机Xampp上不起作用
我当前的网址是.htaccess url:重写在本地主机Xampp上不起作用,.htaccess,xampp,localhost,.htaccess,Xampp,Localhost,我当前的网址是 http://localhost/www.zeeshan.com/user.php?name=zeeshan06 http://localhost/www.zeeshan.com/user.php?name=zeeshan06 我想将我的url显示为 http://localhost/www.zeeshan.com/user/zeeshan06 我使用下面的代码,但它不工作 RewriteEngine on RewriteCond %{REQUEST_FILENAME}
http://localhost/www.zeeshan.com/user.php?name=zeeshan06
http://localhost/www.zeeshan.com/user.php?name=zeeshan06
我想将我的url显示为
http://localhost/www.zeeshan.com/user/zeeshan06
我使用下面的代码,但它不工作
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Options +FollowSymlinks
RewriteBase /
RewriteRule ^user/(.*)user.php?name=$1 [R]
请帮我解决我的问题。谢谢。如果您将此
.htaccess
放入文件夹www.zeeshan.com
:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /www.zeeshan.com/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^user/([^/]+)$ user.php?name=$1 [NC,L]
并访问URL:
http://localhost/www.zeeshan.com/user/zeeshan06
它应该引导您:
上一个将源模式和目标模式混淆的规则OVE代码正在工作&将查询字符串转换为Url重写,可能是万一出现问题,那么它将在第10行
// http://localhost/Milan_Practice/Milan_Mvc/routing.php?name=about
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^(GET|HEAD|POST)\ /Milan_Practice/Milan_Mvc/routing\.php\?name=([^&]+)
RewriteRule ^ /Milan_Practice/Milan_Mvc/routing/%2/%3?%4 [L,R=301]
RewriteRule ^/?Milan_Practice/Milan_Mvc/routing/([0-9]+)/(.*)$ /Milan_Practice/Milan_Mvc/routing.php?name=$1 [L,QSA]