htaccess的重定向与变数

编程入门 行业动态 更新时间:2024-10-25 02:21:08
本文介绍了htaccess的重定向与变数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道有类似的问题,但我试图找出如何我可以重写以下网址:

I realise there are similar questions but I'm trying to work out how I can rewrite the following URL:

www.myWEBaddress/?month=200904

www.myWEBaddress/my-page.php?month=200904

问候

推荐答案

以下内容添加到您的网站的根目录下的的.htaccess 文件。

Add the following to the .htaccess file in the root directory of your site.

RewriteEngine on RewriteBase / RewriteCond %{QUERY_STRING} (^|&)month= [NC] RewriteRule ^ my-page.php [L]

如果你想改变用户看到他们的浏览器地址栏中的URL,最后一个规则更改为

If you want to change the URL that the user sees in their browser address bar, change the last rule to

RewriteRule ^ my-page.php [L,R=301]

更多推荐

htaccess的重定向与变数

本文发布于:2023-11-01 23:23:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550706.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变数   重定向   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!