Php 使用变量重定向wordpress页面
刚刚创建了一个基于Wordpress的网站,现在我有以下问题。没有在Wordpress中构建的旧站点使用变量Php 使用变量重定向wordpress页面,php,wordpress,apache,.htaccess,mod-rewrite,Php,Wordpress,Apache,.htaccess,Mod Rewrite,刚刚创建了一个基于Wordpress的网站,现在我有以下问题。没有在Wordpress中构建的旧站点使用变量p=作为其页面,就像Wordpress一样。现在我试图重定向它们,但这不起作用,我想因为Wordpress也使用了p变量 我想重定向页面http://purplethinking.nl/mauritshof/?p=brunch转到页面http://purplethinking.nl/mauritshof/feestelijk/brunch 我更改了我的.htaccess,并添加了以下行:
p=
作为其页面,就像Wordpress一样。现在我试图重定向它们,但这不起作用,我想因为Wordpress也使用了p变量
我想重定向页面http://purplethinking.nl/mauritshof/?p=brunch
转到页面http://purplethinking.nl/mauritshof/feestelijk/brunch
我更改了我的.htaccess
,并添加了以下行:
RewriteRule ^/mauritshof/?p=brunch$ /feestelijk/brunch/[L]
你能告诉我我做错了什么吗
编辑:这是我完整的.htaccess文件
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mauritshof/
RewriteCond %{QUERY_STRING} ^p=([^&]+)
RewriteRule ^mauritshof/?$ /feestelijk/brunch/ [L,R]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mauritshof/index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基地/毛里肖夫/
RewriteCond%{QUERY_STRING}^p=([^&]+)
重写规则^MARITSHOF/?$/feestelijk/brunch/[L,R]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/mauritshof/index.php[L]
#结束WordPress
您的规则无法运行,因为:
与查询字符串不匹配重写规则
与前导斜杠不匹配重写规则
- 重定向需要一个R标志
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mauritshof/
RewriteCond %{QUERY_STRING} ^p=(brunch)(?:&|$)
RewriteRule ^/?$ /feestelijk/%1/? [L,R]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mauritshof/index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基地/毛里肖夫/
RewriteCond%{QUERY_STRING}^p=(早午餐)(?:&$)
重写规则^/?$/feestlejk/%1/?[左,右]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/mauritshof/index.php[L]
#结束WordPress
您的规则无法运行,因为:
与查询字符串不匹配重写规则
与前导斜杠不匹配重写规则
- 重定向需要一个R标志
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mauritshof/
RewriteCond %{QUERY_STRING} ^p=(brunch)(?:&|$)
RewriteRule ^/?$ /feestelijk/%1/? [L,R]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mauritshof/index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基地/毛里肖夫/
RewriteCond%{QUERY_STRING}^p=(早午餐)(?:&$)
重写规则^/?$/feestlejk/%1/?[左,右]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/mauritshof/index.php[L]
#结束WordPress
感谢您的快速回复!我将这些规则添加到了我的.htaccess中,仍然不走运。你能将你的完整.htaccess粘贴到你的问题中吗?我已经添加了我的.htaccess文件谢谢你的快速回复!我将这些规则添加到了我的.htaccess中,仍然不走运。你能在你的问题中粘贴完整的.htaccess吗?我已经添加了我的.htaccess文件