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:

  1. they not applicable mod_rewrite rule , not found when originaldomain.com/item1.jpg being searched @ newdomain.com/item1.jpg
  2. 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 , loads originaldomain.com/script.php?variables
  • if visits www.newdomain.com/?variables masks , loads originaldomain.com/script.php?variables
  • all other file requests root of newdomain.com pointed relative links @ originaldomain.com, http://newdomain.com/css/stylesheet.css loaded , masked http://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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -