Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex Htaccess重写url不工作_Regex_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Regex Htaccess重写url不工作

Regex Htaccess重写url不工作,regex,apache,.htaccess,mod-rewrite,url-rewriting,Regex,Apache,.htaccess,Mod Rewrite,Url Rewriting,我已经创建了一个.htaccess文件来重写url。但是当我打开应该由htaccess重写的url时,url没有改变。这是我的.htaccess Options +FollowSymLinks -MultiViews RewriteEngine on RewriteRule seller/username/(.*)/ seller.php?username=$1 RewriteRule seller/username/(.*) seller.php?username=$1 请

我已经创建了一个.htaccess文件来重写url。但是当我打开应该由htaccess重写的url时,url没有改变。这是我的.htaccess

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteRule seller/username/(.*)/ seller.php?username=$1    
RewriteRule seller/username/(.*) seller.php?username=$1     
请帮助我,因为我是htaccess的初学者。提前感谢

这样做:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{THE_REQUEST} \s/+seller/\.php\?username=([^\s&]+) [NC]
RewriteRule ^ /seller/username/%1? [R=302,L]

RewriteRule ^seller/username/(.+)/?$ seller.php?username=$1 [L,QSA]

要更改哪个URL?seller.php?用户名={any username}