[Apache 1.3: htaccess mod_rewrite (seemed-simple redirects)] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Apache 1.3: htaccess mod_rewrite (seemed-simple redirects)

(Click here to view the original thread with full colors/images)



Posted by: kristynilsson

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: [url]http://2nilssons.com[/url] 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 [url]http://www.2nilssons.com[/url]
TO [url]http://2nilssons.com[/url]

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 <[url]http://2nilssons.com/Dance/Dance[/url] Quotes.htm> ALSO AS <[url]http://2nilssons.com/Dance/Dance%20Quotes.htm[/url]>
(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 [url]http://2nilssons.com/dancequotes.htm[/url]

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 [url]www.2nilssons.com[/url]
AuthUserFile /home/nilsson/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/nilsson/public_html/_vti_pvt/service.grp
[/code]


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

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

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

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



Posted by: kristynilsson

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 [url]www.2nilssons.com[/url]
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 (.*) [url]http://2nilssons.com/[/url]$1 [R=301,L]

Redirect 301 "/Dance/Dance Quotes.htm" [url]http://2nilssons.com/dancequotes.htm[/url]
[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





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon