Home » Htaccess Tools » Htaccess Questions  » Redirect to a new sub dir but keep the original url. (htaccess attempt to redir to new sub and keep original url.)
Redirect to a new sub dir but keep the original url. [message #1708] Fri, 26 February 2010 04:15 Go to next message
tommytx  is currently offline tommytx
Messages: 6
Registered: February 2007
The incoming url is for example:
hxxp://www.mydomain.com/realestate/mypage.htm

I want to to see the word realestate and if I see it in the url then I want to redirect that url to:
hxxp://www.mydomain.com/adwords/mypage.htm

But I want to keep the url visible as it was originally:
hxxp://www.mydomain.com/realestate/mypage.htm

I have been using the below in htaccess:
ReWriteRule realestate adwords/index.php [L]

When I use the above I get:
hxxp://www.mydomain.com/adwords/mypage.htm

I have seen it done with perl in the SEC Search Engine Cloaker, but I cannot seem to get it to work with php..

Any ideas????

Bottom line is that I want to
It does go to the /adwords directory ok, but the display changes to /adwords instead of remaining as /realestate.

Re: Redirect to a new sub dir but keep the original url. [message #1710 is a reply to message #1708] Fri, 26 February 2010 11:33 Go to previous message
tommytx  is currently offline tommytx
Messages: 6
Registered: February 2007
I have it almost working but I still need some help..please...

RewriteCond %{REQUEST_URI} ^/vabe_forcl_13a_id_100003
RewriteRule ^(.*)$ /adwords/?id=$1

I need to set the condition to pass a test.


Here is the incoming URL: thousands in this format
hxxp://www.mydomain.com/ches_forcl_13a_id_100003
hxxp://www.mydomain.com/norf_forcl_13a_id_100004
hxxp://www.mydomain.com/vabe_forcl_13a_id_100005


So it looks like its in the URI...this "ches_forcl_13a_id_100003"
The only thing that remains constant all the time for every url is the "_id_" portion
So what I need to do is satisfy the condition if the url has "_id_"

Is there a way to evaluate it like the following...

RewriteCond strpos(%{REQUEST URI},=="_id_")

In other words is there a way to satisfy the condition if the characters _id_ is in the URI or in the url anywhere for that matter.

The Rewrite rule works ok if the conditon is met it goes to /adwords and keeps the URI attached.
And the url keeps the original look "http://www.vahud.com/ches_forcl_13a_id_100003" even though it is actually in the /adwords directory.

The way it is, the condition is met but only for the specific one..vabe_forcl_13a_id_100003 and I will need to match thousands of urls using the _id_ that will be in every url.


Previous Topic:directory restricted but files are not
Next Topic:Authentication on specific query string?
Goto Forum:
  


Current Time: Thu Sep 9 15:27:12 CEST 2010

Powered by: FUDforum 3.0.0.
Copyright ©2001-2009 FUDforum Bulletin Board Software