php - .htaccess redirect root to one file, all other files to another -
i have 2 domains using same webspace, originaldomain.com
, newdomain.com
i have placed .htaccess file @ root of newdomain.com
if visitors go it, shows (but masks) url of:
originaldomain.com/script.php
i can similar using following rules:
options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewriterule ^$ http://www.originaldomain.com/script.php [p]
however, style sheets, images , javascript not loading. assume 1 of 2 things:
- they not applicable mod_rewrite rule , not found when originaldomain.com/item1.jpg being searched @ newdomain.com/item1.jpg
- all files may subject having php file stuffed before name, originadomain.com/item.jpg being looked @ newdomain.com/portfolio.phpimage1.jpg
i'm looking create situation where:
- if visits
newdomain.com/?variables
masks , loadsoriginaldomain.com/script.php?variables
- if visits
www.newdomain.com/?variables
masks , loadsoriginaldomain.com/script.php?variables
- all other file requests root of
newdomain.com
pointed relative links @originaldomain.com
,http://newdomain.com/css/stylesheet.css
loaded , maskedhttp://originaldomain.com/css/stylesheet.css
any input appreciated, thank you.
from trial , error, appears working @ moment:
options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewriterule ^$ http://www.originaldomain.com/script.php [p] rewritecond %{request_filename} !^$ [nc] rewriterule ^(.*) http://www.originaldomain.com/script/$1 [p]
Comments
Post a Comment