What does this mod-rewrite code do?

What does all this do?

If I entered domain.com in the address bar, then where is the entry page? I don’t think it’s public/index.php



#php_flag display_errors 0

Options -Indexes
Options +FollowSymLinks

# If a https page request is not part of the store, rewrite it to the http location
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php			-

RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin.php			-

RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$	http://www.domain.com/$1 [L]

#RewriteCond %{SERVER_PORT} 443
#RewriteRule ^$	http://www.domain.com/ [L]
</IfModule>


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


Where’d you get that garbage (WP’s code is okay once the <IfModule> and RewriteBase @#$% is removed) from?

[aside]Sorry, just color me intolerant of nonsense in .htaccess.[/aside]

Regards,

DK

Thanks for the advice. Whilst I understand the code is crap, I don’t quite understand how to change it.

However, I’ve washed my hands with the site that does that - so I’m not too bothered.

However, what do you think of this:

If improvements can be made can you explain how?

Could you especially say about the <IfModule mod_rewrite.c>
part - are you saying to just remove it? I’m sure most mod_rewrite scripts I see are done using this.

The idea is for it to demand a server password and for it to always display the index.php file. Does it do this very well? If not, what would I change.

Thanks for your help.

<Files .htaccess>
order allow,deny
deny from all
</Files>

AuthUserFile /path/.htpasswd
AuthName “Auth User”
AuthType Basic
require valid-user

AddType x-mapp-php5 .php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L,NS]
</IfModule>

John,

How to change it? DELETE the <IfModule> wrapper lines (once you ensure that mod_rewrite is enabled). The reason you see this is that responsible software creators are protecting IDIOTS from server errors (mod_rewrite not enabled). That’s the ONLY reason you see that. If you’re not an idiot, remove the wrappers … simple.

As for the password, that needs to be within the protected directory.

Regards,

DK