简体   繁体   English

301 Apache使用.htaccess joomla重定向不存在的路径

[英]301 apache redirect non existing path using .htaccess joomla

I want to redirect a path: /folder/filename.html to: /folder/newfolder. 我想将路径:/folder/filename.html重定向到:/ folder / newfolder。 My host says I must create a dummy file at /folder/filename.html or it won't redirect. 我的主人说我必须在/folder/filename.html创建一个虚拟文件,否则它将不会重定向。 I can't do this as by creating the /folder, that messes up Joomla which would normally create that part of the path dynamically. 我无法通过创建/ folder来做到这一点,因为它弄乱了Joomla,它通常会动态地创建路径的那一部分。 I'm not sure I believe my host, surely it's possible to redirect a path regardless whether there is a file there? 我不确定我是否相信我的主机,可以确定是否可以重定向路径,而不管其中是否有文件?

RewriteEngine On之后的.htaccess中,只需添加此行

RewriteRule ^/folder/filename.html /folder/newfolder/filename.html [R=301,L]

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

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