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 https://forums.phpfreaks.com/topic/166376-keeping-the-subdomain-and-including-the-files-from-server-root/ Share on other sites More sharing options...
Nix Posted July 17, 2009 Author Share Posted July 17, 2009 Sorry for double posting, browser bug. Delete one of them. Quote Link to comment https://forums.phpfreaks.com/topic/166376-keeping-the-subdomain-and-including-the-files-from-server-root/#findComment-877389 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.