我在.htaccess文件夹中找到了一个/htdocs/wordpress/文件。
url www.example.com指向/htdocs目录。
www.example.com/wordpress调用Wordpress
这是.htaccess的内容
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>我在https://stackoverflow.com/a/27913187/2311074上发现
像这样用RewriteBase ..。 RewriteBase /folder/ RewriteRule a.html b.html 本质上和. RewriteRule a.html /a.html/b.html 但是,当.htaccess文件位于/文件夹/中时,这也指向相同的目标: RewriteRule a.html b.html
所以我想这不需要了?再说,我看不出是什么
RewriteRule ^index\.php$ - [L]在做什么。它要重定向到哪里?总之,最终一切都会被重定向到
RewriteRule . /wordpress/index.php [L]所以第一个RewriteRule无论如何都是重写的,对吗?
上面的.htaccess文件等效于以下内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>发布于 2018-08-23 12:01:00
如果我是正确的,这个规则就是阻止直接访问index.php '-‘当用户尝试直接访问index.php时,将执行403个禁止的访问。
RewriteRule ^index\.php$ - [L]https://stackoverflow.com/questions/51985256
复制相似问题