.htaccess mod_rewrite...我想?
我想知道如何在 .htaccess 中重定向以下 URL:
/mysite.com/blog/Something => /mysite.com/blog.php?tag=某事
这是我在另一个网站上使用过的脚本,但这有点简单:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)$ index.php?name=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?name=$1
</IfModule>
提前致谢
I was wondering how in .htaccess I can redirect the following URL:
/mysite.com/blog/Something => /mysite.com/blog.php?tag=Something
Here is a script I've used on a different site however this is a bit simpilar:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)$ index.php?name=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?name=$1
</IfModule>
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需添加此规则:
更新:根据您的评论,这是您需要的规则:
Just add this rule:
Update: As per your comment this is the rule you will need:
尝试将以下内容添加到站点根目录中的
.htaccess
文件中。如果
something
是变量,则将规则更改为“如果您希望 URL 在用户浏览器中保持不变,则删除
R=301
”,如下所示Try adding the following to the
.htaccess
file in the root directory of your site.If
something
is a variable then change the rule toIf you want the URL to stay the same in the Users browser then drop the
R=301
as below