Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^dev.example.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.dev.example.org$
RewriteRule ^/?(.*)$ http://www.example.org/$1 [R=301,L]
it work, perfectly. But I have my phpMyAdmin folder's permission going crazy when I put the code in my .htaccess.
It won't read CSS files and I cannot view databases etc...
What did I do wrong?
All I want to do is when someone goes to dev.example.org it will change it to www.example.org.
Also I tried working something to force URI http://www.example.org instead of http://example.org, but I failed as it conflicts with my mod_rewrite
RewriteCond %{HTTP_HOST} ^example.org
RewriteRule (.*) http://www.example.org/$1 [R=301,L]
How?
I type http://example.org/blah/
It forces uri to http://www.example.org/index.php?blah=bleh&... etc.
Do the order of conditions in .htaccess have something to do about it?
[edited by: encyclo at 1:28 pm (utc) on Dec. 3, 2007]
[edit reason] switched to example.org [/edit]
The code below illustrates the following changes:
1) Combine non-canonical domain redirects.
2) Exclude phpMyAdmin folder from being redirected.
3) Other corrections and clean-ups.
RewriteCond %{REQUEST_URI} !^/[i]URL_path_to_phpMyAdmin_folder[/i]
RewriteCond %{HTTP_HOST} ^example\.org [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?dev\.example\.org [NC]
RewriteRule (.*) http://www.example.org/$1 [R=301,L]
Jim
RewriteCond %{REQUEST_URI} !^/home/exampleDotOrg/public_html/phpMyAdmin
RewriteCond %{HTTP_HOST} ^example\.org [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?dev\.example\.org [NC]
RewriteRule (.*) http://www.example.org/$1 [R=301,L]
Note: .htaccess is inside public_html folder
Note: I also tried paths:
%{REQUEST_URI} !^/exampleDotOrg/public_html/phpMyAdmin
%{REQUEST_URI} !^/public_html/phpMyAdmin
%{REQUEST_URI} !^/phpMyAdmin
All failed :/
Also, I would like to add couple of redirections.
1. blah.example.org/(anything goes after) -> www.example.org/blah/(anything goes after)
2. blah1.example.org/(anything goes after) -> www.example.org/blah1/(anything goes after)
And so on, how can I do it properly?
[edited by: Saturn at 3:25 pm (utc) on Dec. 3, 2007]
[edited by: jdMorgan at 4:27 pm (utc) on Dec. 3, 2007]
[edit reason] No URLs please. [/edit]
RewriteCond %{REQUEST_URI} !^/phpMyAdmin As for the redirects, one thing you can do to help preserve your sanity is to refrain from adding 'features' until your core functions have been thoroughly tested and proven to work. This is a method that Microsoft might well profit from following... ;)
Jim
Contact your host, and ask them where your error log is located. Trying to debug this problem without it may prove impossible.
Jim
[edited by: jdMorgan at 6:21 pm (utc) on Dec. 3, 2007]