Apache 1.3: htaccess mod_rewrite (seemed-simple redirects)

kristynilsson

New Member
Apache 1.3: htaccess mod_rewrite (seemed-simple redirects)

Good afternoon, and much thanks in advance!

Two issues, seemingly minor - but I'm drowning in htaccess mod_rewrite. Mea culpa: I am a ballet choreographer with a growingly popular and huge set of dance quotes on a page I named before I understood the importance of naming protocols.

Site: http://2nilssons.com Server: Apache 1.3.37 (Unix) Host: midphase

1. Exclude www redirect: optimized search engine results (have registered as such w/Google, but for other engines need redirect in htaccess)
FROM http://www.2nilssons.com
TO http://2nilssons.com

2. Path/file rename redirect: corrections for crappy, capitalized, too-long titling disease to exclude unnessary sub-dirs and title gaps that result in %20. Most critical example:
FROM <http://2nilssons.com/Dance/Dance Quotes.htm> ALSO AS <http://2nilssons.com/Dance/Dance%20Quotes.htm>
(the above paths are no longer working, as I thought my .htaccess redirects would work, and I've already done the site mods... hence the urgency)
TO http://2nilssons.com/dancequotes.htm

Attempted .htaccess redirects to no avail; neither redirect is working.


Here is the original .htaccess code; the website and uploads function properly:

Code:
# -FrontPage-

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

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName www.2nilssons.com
AuthUserFile /home/nilsson/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/nilsson/public_html/_vti_pvt/service.grp


A. This is my attempt at the exclude www redirect:
Code:
RewriteEngine ON
RewriteRule ^/Dance/Dance%20Quotes.htm$ http://2nilssons.com/dancequotes.htm$1 [L,R=permanent]

B. These are my attempts at the redirect to simpler path names:
Code:
RewriteEngine ON
RewriteRule ^/Dance/Dance%20Quotes.htm$ http://2nilssons.com/dancequotes.htm$1 [L,R=permanent]

Also, w/o the "/" afer "^" and before first "Dance" in first path:
Code:
RewriteEngine ON
RewriteRule ^Dance/Dance%20Quotes.htm$ http://2nilssons.com/dancequotes.htm$1 [L,R=permanent]

The rewrites don't accomplish the redirects. Further: if installed below existing, working .htaccess code - site works, but uploads don't work; and, if installed after the "IndexIgnore" statement and before the "order deny,allow" statement, the site stops working immediately.

Any help and guidance with this will be enormously appreciated!

Much thanks to anyone that can help!


Kristy Nilsson / Atlanta
 
Initial Challenges Solves - Smaller New Ones...

INITIAL PROBLEMS SOLVED (code solution below) -
ONE SMALL NEW PROBLEM, and two small additional questions.

Last Issues:

1) We discovered that with the addition of the new .htaccess file code, we can't access the server for updating the website. IE: to do updates, we have to strip out the added code from .htaccess, do the update, then reinstall the new code in .htaccess again. Any thoughts, anyone?

2) How many Redirect statements can one safely enter in the .htaccess file?
We may need to apply this solution to a few more files; does anyone know if there is a practical or absolute limit?

And, should we add an [L] at the end of the last statement, or any of other code (Permanent, etc.)


Here's the code that solved the two issues (see original post for the pre-existing .htaccess code):


code]
# -FrontPage-

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

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName www.2nilssons.com
AuthUserFile /home/nilsson/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/nilsson/public_html/_vti_pvt/service.grp

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^2nilssons\.com [NC]
RewriteRule (.*) http://2nilssons.com/$1 [R=301,L]

Redirect 301 "/Dance/Dance Quotes.htm" http://2nilssons.com/dancequotes.htm
Code:
Thank you to everyone for your think-time and attention on this.

Any thoughts on the additional questions/problems will be greatly appreciated.


Kristy (and Scott) Nilsson
 
Back
Top