php - Apache mod_rewrite for a specific domain under same directory -


i have wrote website using php & yii framework, , there have .htaccess file has mod_rewrite statement use clean url's:

options +followsymlinks indexignore */*  rewriteengine on  rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d  rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] 

for example use domain: www.example.com & popstan.net, , url rewriting these domains works like in dream!

however, i'm creating blog, , yii controllers have structure accessing blog articles, blog categories , single blog article:

now, wish use blog, under domain: http://blog.example.com/, , maintain url structures, , wish not copy website on 2 separate directoryies (ie. blog directory).

is possible use mod_rewrite rewrite url's domain, have url's fetched parent directory?

you should :

1) create blog.example.com virtual host points same directory,

2) define corresponding url rules in yii config, e.g. :

'http://blog.example.com/<action:\w+>/<param:\w+>'=>'/blog/<action>', 'http://blog.example.com/'=>'/blog/index', 

you don't need modify .htaccess.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -