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
dklynn
December 17, 2010, 12:19am
2
johnsmith153:
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
It’s whatever is directed by DirectoryIndex in the server config file, the virtual host config file and the .htaccess file(s) in the path.
#php_flag display_errors 0
Options -Indexes
[COLOR="Blue"]# don't show a TOC of the current directory if the file can't be found[/COLOR]
Options +FollowSymLinks
[COLOR="Blue"]# allow redirections[/COLOR]
# If a https page request is not part of the store, rewrite it to the http location
<IfModule mod_rewrite.c>
[COLOR="Red"]# webmaster is an idiot - for testing on EVERY request whether mod_rewrite is enabled and expecting different result each time[/COLOR]
RewriteEngine On
[COLOR="Blue"]# make sure that mod_rewrite is not in comment mode[/COLOR]
RewriteBase /
[COLOR="Red"]# means that webmaster thinks that there are Redirects in operation but messes up path/to/file for mod_rewrite[/COLOR]
RewriteCond %{SERVER_PORT} 443
[COLOR="Blue"]# request is to secure server[/COLOR]
RewriteCond %{REQUEST_FILENAME} !-f
[COLOR="Blue"]# request does NOT exist as a file[/COLOR]
RewriteCond %{REQUEST_FILENAME} !-d
[COLOR="Blue"]# request does NOT exist as a directory[/COLOR]
RewriteRule ^index.php -
[COLOR="Blue"]# even without a PT (pass through) flag, serve indexXphp where X is ANY character[/COLOR]
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>
dklynn
December 17, 2010, 8:05am
4
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