Ron
Ron

Reputation: 181

Simple URL rewrite, not redirect, with .htaccess

I'm pretty inexperienced with .htaccess so please bear with me.

I have a domain - "http://www.exampletest.com"

which redirects to a folder at a different domain where I have hosting i.e:

"http://www.differenturl.com/exampletest"

Is there an easy mod_rewrite rule where I could have anything at "http://www.differenturl.com/exampletest" show up as "http://www.exampletest.com?" An example would be:

"http://www.differenturl.com/exampletest/user.php" -> "http://www.exampletest.com/user.php"

Any assistance is greatly appreciated. I assume this easy so sorry to ask such a basic question.

Thanks

Upvotes: 1

Views: 1128

Answers (2)

Ali
Ali

Reputation: 11

If I have understood correctly, following code might do:

RewriteRule exampletest/(.*)$ http://www.exampletest.com/$1 [R=301,L]

Please note that you add this line in the .htaccess file placed on differenturl.com server.

Hope that helps.

Cheers

Upvotes: 1

Laurence Gonsalves
Laurence Gonsalves

Reputation: 143154

You say "rewrite, not redirect", so no, there isn't a simple way to do this. The only way to do what you ask would be to have a "reverse proxy" running on www.exampletest.com that fetches content from "www.differenturl.com/exampletest/". That isn't something you can do with mod_rewrite.

Upvotes: 1

Related Questions