0

My website has that URL structure:

and in CodeIgniter route file

$route['sign-up'] = 'members/signup'; $route['blog'] = 'blog/home'; 

I would like to have instead:

My hosts file is ok:

127.0.0.1 www.mywebsite.com 127.0.0.1 mywebsite.com 127.0.0.1 blog.mywebsite.com 127.0.0.1 signup.mywebsite.com 

Im trying many tips with RewriteCond and RewriteRule but I don't find the good match...

Thank's!

1 Answer 1

3

I think you could easily "hack" your config/route.php file that way without even modifying your .htaccess :

if ($_SERVER['SERVER_NAME'] == 'blog.mywebsite.com') { $route['default_controller'] = 'blog/home'; // Other routes to your blog } elseif ($_SERVER['SERVER_NAME'] == 'signup.mywebsite.com') { $route['default_controller'] = 'members/signup'; // Other routes for your signup } 
Sign up to request clarification or add additional context in comments.

6 Comments

Hello, when i'm accessing to 'blog.mywebsite.com' i'm redirecting to the root server path such as localhost. my .htaccess: RewriteCond $1 !^(index\.php|src|upload|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
Your htaccess seems ok, but what do you mean by redirected. Does the server respond 302 Redirect or 301 Redirect ?
Hello MaxiWheat. I don't know about many redirects styles, I would like to see the subdomain in the navbar but call the "default" route, [URL]/blog for example.
Nop, I want what I wrote on the main post, nothing more, nothing less. I just gave you my .htaccess content to show you that you have suggested does not work. I'm totally noob in htaccess file. However, I appreciate that you are trying to help me!
Ok... When you say you are redirected to localhost, does the URL in your browser change or does it stays what you typed?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.