简体   繁体   English

找不到对象! 网址重写

[英]Object not found! url rewrite

I have rewrited my url's with htaccess and now I the following URL 我用htaccess重写了我的网址,现在我将以下网址

This is my old URL: 这是我的旧网址:

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

The new URL: 新网址:

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

The .htaccess file: .htaccess文件:

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

It get an Object not found! 它得到一个找不到的对象! response, kindly help 回应,请帮忙

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

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

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

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