Mar*_*mes 4 .htaccess redirect url-rewriting web
我想将目录中的所有页面重定向.com/blog
到.com/error
目录.
我已经在网上搜索,发现的做不同的方式加载,但我希望它重定向到一个单独的页面.
我尝试的所有东西都重定向到相同的文件名,但在不同的目录中.例如,.com/blog/index.nonexisting
重定向到.com/error/index.nonexisting
.
我希望第一个目录中的所有文件都重定向到某个文件,所以如果你去.com/blog/whatever.php
它会去.com/error/index.php
,如果你去,.com/blog/random.xml
你会被重定向到.com/error/index.php
.
有没有办法做到这一点?
试着把它放在你的.htaccess中:
RewriteEngine on
RewriteRule ^blog/(.+) error/index.php [L,R]
Run Code Online (Sandbox Code Playgroud)
如果您想要301重定向,请替换R
,R=301
如果您R
不想要外部重定向,请完全删除.
归档时间: |
|
查看次数: |
9442 次 |
最近记录: |