I'm new to .htaccess
and I have below code in my file;
我是.htaccess的新手,我的文件中有以下代码;
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Currently WordPress handles all the requests. I've updated my site recently and now I want to add few more rules to the .htaccess
.
目前WordPress处理所有请求。我最近更新了我的网站,现在我想在.htaccess中添加更多规则。
How can I restrict WordPress to handle only requests that starts with /blog/
?
如何限制WordPress只处理以/ blog /开头的请求?
Also I want to add additional rules to ReWrite
requests to /cars
to /index.php/site/cars
另外,我想向ReXrite请求添加额外的规则/ cars到/index.php/site/cars
1 个解决方案
#1
The issue was due to my lack of knowledge how .htaccess
works. I've fixed the issue by moving the .htaccess
for the wordpress
to the /blog
directory and creating a new .htaccess
with required rules in the /
.
问题是由于我缺乏知识.htaccess的工作原理。我通过将wordpress的.htaccess移动到/ blog目录并在/中创建一个带有必需规则的新.htaccess来解决这个问题。
#1
The issue was due to my lack of knowledge how .htaccess
works. I've fixed the issue by moving the .htaccess
for the wordpress
to the /blog
directory and creating a new .htaccess
with required rules in the /
.
问题是由于我缺乏知识.htaccess的工作原理。我通过将wordpress的.htaccess移动到/ blog目录并在/中创建一个带有必需规则的新.htaccess来解决这个问题。