2012-02-08 132 views
0

我想覆盖1个特定文件的WordPress网址重写。我目前的wordpress安装会将.html文件重写为相应的.php扩展名。所以,我的wordpress安装中的永久链接可能看起来像www.mysite.com/mypage.html。覆盖Wordpress网址重写

我有一个实际的HTML文件,我想说明,但htaccess的自动保持默认情况下对其进行改写,这是我想要使用忽略此特定的文件

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^/forex-system-demo\.html$ [NC] #<-- This is the file i want to ignore and run as a NORMAL .HTML file 
RewriteRule . /index.php [L] 
</IfModule> 

我可以有代码有一些奇怪的浏览器缓存正在进行,因为下面的内容现在在清除缓存后有效。

这里是解决方案:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteRule ^forex-system-demo.html$ - [L] 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
+0

您是否尝试过把有问题的行头? – 2012-02-08 16:14:11

+0

yes sir,no go =( – 99823 2012-02-08 16:21:20

+0

什么是HTML的文件权限?'RewriteCond%{REQUEST_FILENAME}!-f'这一行应该检查它是否是一个实际的文件,如果Apache没有读取权限,不'看''文件 – 2012-02-08 16:27:16

回答

1

这里是解决方案:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteRule ^forex-system-demo.html$ - [L] # <- this is where I tell wordpress to ignore this url 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule>