Forum Moderators: phranque
I am developing a website in PHP + MySQL, which makes 'heavy' use of URL rewriting, for example:
================
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.net$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.net/$1 [R=301,L]
RewriteRule login/?$ login.php [NC,L]
RewriteRule register/([a-z0-9]+)/?$ register.php?rc=$1 [NC,L]
RewriteRule request/?$ request.php [NC,L]
RewriteRule ([a-z0-9\_-]+)/logout/?$ logout.php?account=$1 [NC,L]
(and other 20 or more rules ...)
=================
the problem is that i defined a subdomain like blog.mydomain.net, where i installed Wordpress, and i wouldnt want the .htaccess have effect into the subdomain, when i insert the URL: http:://blog.mydomain.net
as when i load that URL i get:
==================
Not Found
The requested URL /home/mydomain/public_html/index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.37 Server at blog.mydomain.net Port 80
=================
take in count that the subdomain absolute path is : /home/mydomain/public_html/blog
if i try adding some rule to make a simple redirect i fall into infinite loop, like:
RewriteCond %{HTTP_HOST} ^blog.mydomain.net$ [NC]
RewriteRule ^(.*)$ http:://blog.mydomain.net/$1 [R=301,L]
The idea is that any rule working for the domain shouldnt have any effect at the subdomain; say also that if loading the index page of blog, like: http:://blog.mydomain.net/index.php then it works, and other pages too, but if i load profile.php in wp-admin subfolder of the subdomain then it doesnt work ...
maybe need a directive for subdomain to search for index.htm index.html index.php default.htm etc?
I guess i am missing something here (related to rules in the .htaccess of root domain), so i would appreciate some light about this issue, thanks in advance.
Ibon
[edited by: jdMorgan at 6:37 pm (utc) on Oct. 23, 2006]
[edit reason] De-linked [/edit]
RewriteCond %{HTTP_HOST} ^blog\.mydomain\.net(:80)?$ [NC]
RewriteRule (.*) - [L]
If you need finer control, see the RewriteRule [S] (skip) flag, or add a negative RewriteCond to each rule you don't want processed for the blog subdomain. Example:
RewriteCond %{HTTP_HOST} !^blog\.mydomain\.net$ [NC]
RewriteRule login/?$ login.php [NC,L]