Welcome Guest, Not a member yet? Register   Sign In
YARQ (yet another routing question) re: sub domains
#1

[eluser]unsub[/eluser]
Hi
I've searched the forum but perhaps my skill or comprehension is lacking, for I can't seem to milk a working solution out of everything I've read.

I am trying to send all requests to http://www.domain.com/subdomain/$whatever to here:
http://www.domain.com/subdomain/page/index function/$whatever, where $whatever will be used as the argument for index.
I can only get this to work by typing in http://www.domain.com/subdomain/page/$whatever.
It accepts the argument (as uri segment 2) and functions nicely.

Here is what I have in my routes:
Code:
$route['default_controller'] = "page";
$route['scaffolding_trigger'] = "";
// I want 'contact' to be sent to the specific contact controller
$route['^(?!contact).*']="page/index/$0";

here is what is in my .htaccess
Code:
#DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico|license.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdomain/index.php/$1 [L,QSA]
so... any of you smart folk know what I'm doing wrong?
I'm not looking for anyone to write my code for me here, but maybe some reading material that goes into some more depth than the user manual on routing for subdomains?

Thanks bunches Smile
#2

[eluser]unsub[/eluser]
crap...

ok, I got it working, but I still need advice, as the way I have it working now seems like it's a bit ugly...

I changed the .htaccess rules to this:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico|license.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/contact/
RewriteRule ^(.*)$ /subdomain/index.php/$1 [L,QSA]

but left the routes the same. I don't know... should I be using both? this just seems... inelegant to me. Sad

thnx for any advice on this.




Theme © iAndrew 2016 - Forum software by © MyBB