Jump to content

Keeping the subdomain and including the files from server root


Nix

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.