0

I found a .htaccess file in the /htdocs/wordpress/ folder.

The url www.example.com points to the /htdocs directory.

Wordpress is called by www.example.com/wordpress

This is the content of the .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>

I found in https://stackoverflow.com/a/27913187/2311074 that

Using RewriteBase like this...

RewriteBase /folder/
RewriteRule a\.html b.html

is essentially the same as...

RewriteRule a\.html /folder/b.html

But when the .htaccess file is inside /folder/ then this also points to the same target:

RewriteRule a\.html b.html

So I guess its not needed? Further, I don't see what

RewriteRule ^index\.php$ - [L]

is doing. Where is it redirecting to? Anyway, everything will be redirected in the end to

RewriteRule . /wordpress/index.php [L]

so the first RewriteRule is rewritten anyway, right?

Is the above .htaccess file equivalent to this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
Adam
  • 25,960
  • 22
  • 158
  • 247

1 Answers1

0

If I am correct this rule is preventing direct access to index.php here '-' will do 403 forbidden access when a user attempt direct access to index.php.

RewriteRule ^index\.php$ - [L]
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45