Apache 使用htacess将一条路径重定向到另一条保留旧路径的路径';文件名
我想重定向一个URL:Apache 使用htacess将一条路径重定向到另一条保留旧路径的路径';文件名,apache,.htaccess,mod-rewrite,url-redirection,Apache,.htaccess,Mod Rewrite,Url Redirection,我想重定向一个URL:www.example.com/folder1/folder2/about.php 另一个URL地址:www.example.com/folderA/about.php 使用.htacess可以吗?我正在使用Wordpress。是的,这是可能的。在Wordpress规则之前尝试此规则 # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Your redirect
www.example.com/folder1/folder2/about.php
另一个URL地址:www.example.com/folderA/about.php
使用.htacess可以吗?我正在使用Wordpress。是的,这是可能的。在Wordpress规则之前尝试此规则
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Your redirect rules
RewriteCond %{REQUEST_URI} ^\/folder1\/folder2\/([^\/]+)$ [NC]
RewriteRule ^ http://%{HTTP_HOST}/folderA/%1 [R=301,NC,L]
# Your redirect rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基/
#你的重定向规则
RewriteCond%{REQUEST_URI}^\/folder1\/folder2\/([^\/]+)$[NC]
重写规则^http://%{http_HOST}/folderA/%1[R=301,NC,L]
#你的重定向规则
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress