Forum Moderators: phranque

Message Too Old, No Replies

Cut the junk out of my htaccess file

From old FrontPage directives to cumbersome redirects, some advice please.

         

wocka

8:07 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



Here's what I've got. The 301 non-www to www is not working, and I think it has to do with something that's no longer necessary overriding it. Can someone who knows explain? I've tried searching the forums, can't find any pointers for this particular case.

I'm aching to rip out the FrontPage installed crap, but I don't want to screw anything up. I no longer have any Microsoft borders or anything, and I no longer use FrontPage at all to edit/upload my site.

TIA.

_______________________________________

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.domain.com
AuthUserFile *snip*
AuthGroupFile *snip*

<Files 403.shtml>
order allow,deny
allow from all
</Files>

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) [domain.com...] [R=301,L]

deny from 65.**.150.250
deny from 209.***.117.56
deny from 24.***.134.6
deny from 67.**.68.2
deny from 209.***.50.22

*snip, about 50 permanent redirects*

deny from 67.**.16.30
deny from 62.***.50.55
deny from 212.***.76.195
deny from 81.**.49.71
deny from 212.***.65.221
deny from 67.**.56.4
deny from 212.***.65.179
deny from 24.***.21.218

_______________________________

[edited by: jdMorgan at 8:19 pm (utc) on July 25, 2005]
[edit reason] Removed specifics per TOS. [/edit]

jdMorgan

8:21 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to add RewriteEngine on [httpd.apache.org] ahead of your rewrite code, and you *may* also need to add Options +FollowSymLinks [httpd.apache.org] ahead of that.

Jim

wocka

1:00 am on Jul 27, 2005 (gmt 0)

10+ Year Member



Thanks, JD. RewriteEngine On did the trick. To make it all work with my stylesheets, I had to s/r every [myurl.com...] with [myurl.com,...] otherwise the CSS didn't work. But the www redirect is now fully functional.

Any thoughts on what FrontPage crap can be removed? I'm thinking the following can safely go:

___________________

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

________________________-

Thoughts?

jdMorgan

2:23 am on Jul 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I had to s/r every [myurl.com...] with [myurl.com...]

s/r - What does that mean? Search and replace?

A single 301 redirect at the top of the file should suffice to fix all domain->www.domain issues, though, and it's recommended to prevent duplicate-content "issues" with search engines anyway.

I would leave .htaccess and .htpasswd in the IndexIgnore list. However, IndexIgnore itself is only necessary if you have (or might have, by accident or design) directories with no index *file* defined, as in "index.html". In this case, Apache produces a page that lists all files and subdirectories in that directory, and IndexIgnore tells it to *not list* some files.

As always, make a backup of your current .htaccess file before changing anything. Or comment out the lines in question by adding a "#" to the beginning if you are editing the file on the server. I prefer to do both, actually.

I guess I need to go clean up my main .htaccess file -- it's currently 37 kB. So if I "sound" amused with this project, that's why... ;)

Jim