views:

50

answers:

1

I am so about to kick mod_rewrite to the curb. Talk about "doesn't play well with others." Are there any witchdoctors about that can help me with this?

I have wildcard dns set up to identify users. I would like to go from:

http://username.domain.com/foo/bar

to:

https://www.domain.com/qux/waldo/username/foo/bar

Is this possible?

I'm developing with codeigniter and it has it's own mod_rewrite directives in .htaccess already, to strip out the index.php.

Here's what I've got:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.idseal\.local.*$
RewriteRule (.*) /site/assign/$1

#Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
A: 

First line verify if we are on the main domain or not, second line will match if there is a www or not, if there is a www it will be held on %1 thus making no changes if there inst, the data will be into %2 and will rewrite just fine.

I am not 100% sure this will work out for your needs but give it a try and report it back and i will try to assist you with what i can.

RewriteEngine on

RewriteCond %{http_host} !^www.domain.com [NC]
RewriteCond %{http_host} ^(www.)?([^.]+).domain.com [NC]
RewriteRule (.*) https://www.domain.com/qux/waldo/%2/$1
Prix