.htaccess - htaccess: one controller under root control all pages under all subdomains without redirect -


i need htaccess file under root folder.

please see photo url: site structure (sorry, can not upload image here)

i have lots of cities folder subdomains, not wish every subdomain needs separated admin, wish can control them under same admin page.

so if want :

ny.example.com/news.php ==> example.com/controller/ny/news ( or example.com/controller.php?city=ny&section=news)

how can write htaccess file please ?

in root htaccess, add these rules :

rewriteengine on  rewritebase / rewritecond %{http_host} ^([^.]+)\.example\.com$ [nc] rewriterule ^ controller/%1/news/ [r,l] rewritecond %{request_filename} !-d rewriterule ^controller/([^/]+)/([^/]+)/?$ controller.php?city=$1&section=$2 [nc,l] 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -