我试图覆盖wordpress url重写一个特定的文件。我当前的wordpress安装会将.html文件重写到相应的.php扩展名。因此,对于wordpress安装中的permalink,可能类似于www.mysite.com/mypage.html。
我想显示一个实际的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>
我可能已经进行了一些wierd浏览器缓存,因为下面的内容在清除缓存后才能工作。
这里是解决方案:
<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>
发布于 2012-03-06 15:27:08
以下是解决办法:
<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>
https://stackoverflow.com/questions/9196752
复制相似问题