在wordpress中输入自己的.htaccess重写规则


Enter own .htaccess rewrite rules in wordpress

我想在我的htacces中编写一个自己的重写规则。重定向本身工作正常,但Wordpress使用$_SERVER["REQUIRE_URI"]验证URI。所以网站标题会自动更改为找不到的页面,循环不起作用等等

有办法这样做吗?

如果没有,还有其他的可能性吗?实际上我只需要一个从"www.example.com/test/""www.example.com/t.php?a=1的非常简单的重定向。"所以它是完全静态的,我根本不需要模式。我已经用"frameset"尝试过了,但这看起来很难看,而且过程很慢。

非常感谢

Jakob

我的.htaccess文件:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# My Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Malta/$ http://www.reisekontrast.de/Index?malta=1  [QSA,L]
RewriteRule ^China/$ http://www.reisekontrast.de/Index?china=1  [QSA,L]

# WP Rules
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我们需要您的原始.htaccess文件。这是一个简单的重写(重定向),但wordpress已经有了URL重写规则。为了最大限度地帮助您,我们需要与您已经运行的设置保持一致。否则,你只会破坏Wordpress,但让你的URL正常工作。

此外,作为一个入门问题,您的服务器是否支持htaccess中的完全覆盖?

基于您的HTACCESS文件,我将添加"自定义"规则部分。这样,它就绕过了在这种类型的重写中任意的"重写条件"。

希望这能有所帮助!如果我能提供更多细节或其他选择,请告诉我。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Custom rules
RewriteRule /test/(.*) http://example.com/t.php?a=1 [NC]
# My Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Malta/$ http://www.reisekontrast.de/Index?malta=1  [QSA,L]
RewriteRule ^China/$ http://www.reisekontrast.de/Index?china=1  [QSA,L]

# WP Rules
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>