Forum Moderators: phranque
redirect 301 /emet http://www.example.org
Well, for some reason, it wasn't, I had to add additional redirects (see below). Now, I am getting errors that leave out the directory I redirected to. For instance, I had a file with the path:
http://www.quux-foo.org/emet/analysis/greatlie.php
Now, for some reason, I am getting errors that point to non-existent files at (and all the other sub-directories):
http://www.quux-foo.org/analysis/greatlie.php
The code above should be redirecting it. Below is my .htaccess file. Any ideas of what is happening?
redirect 301 /emet http://www.example.org
redirect 301 /emet/analysis/ http://www.example.org/analysis/
redirect 301 /emet/documents/ http://www.example.org/documents/
redirect 301 /emet/views/ http://www.example.org/views/RewriteEngine on
RewriteRule ^current\.php$ http://www.example.org/current.php
RewriteRule ^current\.htm$ http://www.example.org/current.php
RewriteBase /
RewriteRule ^(.*)\.htm$ $1 [C,E=WasHTML:yes]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1,R]
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.htm
AddType text/html .html .htm
IndexIgnore *
RewriteRule ^weblog/?(.*)$ /cgi-bin/blosxom.cgi/$1
<Files .htaccess>
order allow,deny
deny from all
</Files>
AddHandler server-parsed .html .htm
ErrorDocument 400 /errorpage.php
ErrorDocument 401 /errorpage.php
ErrorDocument 403 /errorpage.php
ErrorDocument 404 /errorpage.php
ErrorDocument 500 /errorpage.php
<Files 403.shtml>
order allow,deny
allow from all
</Files>
<Files php.ini>
Order allow,deny
Deny from all
</Files>
SetEnv TZ EST5EDT
[edited by: jdMorgan at 11:25 pm (utc) on Dec. 14, 2006]
[edit reason] No URLs, please. See Terms of Service. [/edit]
Module execution order is controlled by the LoadModule list order in Apache 1.x, and by an internal priority scheme in Apache 2.x.
So, if you are seeing strange results, it might be a good idea to do two things: First comment out all but one set of RewriteRule and Redirect directives, so that you are testing only one small representative set of URLs. Then try rewriting the code so that all redirects and rewrites use mod_rewrite, instead of using a mixed mod_rewrite/mod_alias solution.
Once you get the one case working, it will be easy to implement the same approach for the other sets of URLs.
"Divide and conquer> Simple is good."
Jim