繁体   English   中英

找不到对象! 网址重写

[英]Object not found! url rewrite

我用htaccess重写了我的网址,现在我将以下网址

这是我的旧网址:

http://example.com/user.php?username=collins1

新网址:

http://example.com/user/collins1/

.htaccess文件:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^user\.php$ %{QUERY_STRING} [C]
RewriteRule ^username=(.*) /user/$1/? [R=301,L]

它得到一个找不到的对象! 回应,请帮忙

您正在重定向而不重写您的网址,对于内部重写请使用此

RewriteEngine On RewriteRule ^user/([^/]*)/$ /user.php?username=$1 [L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM