Nix Posted July 17, 2009 Share Posted July 17, 2009 Hi, mates! I'm having a headache since I tried messing up with mod_rewrite... The story follows: [*]Visitor types: http://abc.example.com [*]htaccess calls for http://example.com/profile.php?id=abc and displays abc's profile within abc virtual subdomain everything is cool and calm until I try to call any page from root: http://abc.example.com/page1.php The page doesn't show, neither displays any error. It just returns to the previous page with the same content as before opening page1.php from root. At the moment, I use the following .htaccess code: Options +FollowSymlinks RewriteEngine on # as I hate www, I hide it with this: RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www\.)?distorzija\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.distorzija\.com$ [NC] RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L] # with this I call for user ID and display the content via profile.php RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^(www\.)?distorzija\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.distorzija\.com$ [NC] RewriteRule ^(.*)$ /profile.php?username=%2 [QSA,L] ErrorDocument 404 /404.php The point of my agony is: i need to keep the url (abc.example.com) even when opening files from root... Hope I explained the issue understandable... Tnx in advance! Nix Quote Link to comment Share on other sites More sharing options...
dreamwest Posted July 20, 2009 Share Posted July 20, 2009 abc has to be a real directory even with wildcard subdomains so http://abc.site.com (fake) will need a pysical address http://site.com/abc (real) In the real directory add another htaccess , also theres a thing you can do to make the root htaccess relevant for all directories Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.