Redirecting html links from subdomain to root domain

I have a subdomain named store.domain.com. It holds the php application for shopping cart.  But there are some links within the subdomain that point back to the root domain to specific files htm files.  I have tried using htaccess to change this:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.+)\.htm$ http://www.rootdomain.com/$1.htm [QSA]

I heard there may be a problem with cross-domain linking or something like that?
Is there a way to do this php wise as well?

But I get an error.  This is on a Godaddy server. I dont have root access.

Please assist.

IcarusOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jar3817Commented:
Try adding "RewriteBase /" after the "RewriteEngine ON" directive. I'm using mod_rewrite on godaddy as well and found I needed that line for it to work.
0
IcarusOneAuthor Commented:
Thanks Jar but I still get and error:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.+)\.htm$ http://www.domain.com/$1.htm [QSA]

*Scratch head*
0
jar3817Commented:
What error do you get?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

IcarusOneAuthor Commented:
Internal server Error 500
0
jar3817Commented:
I'm talking about the error msg in the logs.

To go http://yourgodaddyhosteddomain.com/stats/logs/

Look at the newest log file and see what it says.
0
IcarusOneAuthor Commented:
mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

Please advise.
0
jar3817Commented:
You have an infinite loop. Your redirection destination matches the lookup too. You need to change it, try this:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule store.domain.com/(.+)\.htm$ http://www.domain.com/$1.htm [QSA]
0
IcarusOneAuthor Commented:
Now when i hover over trad_shows.htm , it says store.domain.com/trade_shows.htm and when i click it, it give me a 404 says /trade_shows.htm is not found on server and the logs say:
File does not exist: /var/chroot/home/content/e/e/m/blah/html/controller/trade_shows.htm
I am using a subdomain setup in Godaddy control panel for store.domain.com which points to /controller/.
0
jar3817Commented:
Does "/var/chroot/home/content/e/e/m/blah/html/controller/trade_shows.htm" actually exist?
0
IcarusOneAuthor Commented:
Well i took out my account name, but no the file is not within that folder...its under /html/trade_shows.htm
0
IcarusOneAuthor Commented:
Can anyone please assist?
0
jar3817Commented:
According to the docs (http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html) mod_rewrite will strip out the http://host:port part of a redirect unless you use the R flag. So since you're effectively doing an external redirect even though it's technically on the same server, you'll need to do it like this:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule store.domain.com/(.+)\.htm$ http://www.domain.com/$1.htm [QSA,R=301]

*the 301 is the http code for "moved permanently"
0
IcarusOneAuthor Commented:
Error: File does not exist: /var/chroot/home/content/e/e/m/eemktg/html/controller/trade_shows.htm

store.domain.com points to html/controller

this is what I have:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule store.domain.com/(.+)\.htm$

http://www.domain.com/$1.htm [QSA,R=301]
0
jar3817Commented:
Ok, try a different approach:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^store.domain.com [NC]
RewriteRule ^(.*)\.htm$ http://www.domain.com/$1.htm [L,QSA,R=301]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IcarusOneAuthor Commented:
How would i configure it so that any image files will be called from root/images/ instead of subdomain/images?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.