Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.