重写的干净 URL 未显示为默认 URL
我使用 .htaccess
文件为我的网站创建了重写的 URL。
这是文件的内容。
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ myfile.php?firstvar=$1&secondvar=$2&thirdvar=$3&fourthvar=$4
当我检查时,我发现我的网站页面的新干净 URL 已成功创建。像这样:
www.mydomain.com/value1/value2/value3/value4
对于原始 URL:
www.mydomain.com/myfile.php?firstvar=value1&secondvar=value2&thirdvar=value3&fourthvar=value4
新域正确重定向到原始页面并且看起来更清晰。我喜欢它。
但问题是,当我点击主页上的页面时,它仍然显示原始网址。如果我在地址栏中输入新的干净 URL,它会正确重定向到该页面,但它不是默认 URL。它在那里,但不会自然地出现在网站上。
如何将我的网站的新 URL 设置为默认 URL? (也许还在使用.htaccess
?)
I have created rewritten URLs for my site using .htaccess
file.
Here is the content of the file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ myfile.php?firstvar=$1&secondvar=$2&thirdvar=$3&fourthvar=$4
And when I checked, I found out that new clean URLs for the pages of my site has been created successfully. Like this :
www.mydomain.com/value1/value2/value3/value4
for the original URL :
www.mydomain.com/myfile.php?firstvar=value1&secondvar=value2&thirdvar=value3&fourthvar=value4
The new domain redirects to the original page properly and looks clearer. I like it.
But the problem is, that when I click the page on the main page, it still shows the original url. If I input the new clean URL in the address bar, it redirects to the page properly, but it is not a default URL. It is there, but it does not appear on the site naturally.
How do I set the new URL the dafault URL for my website? (still using .htaccess
maybe?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论