Reply
RewriteRule help
Old 05-08-2008, 09:27 PM Question RewriteRule help
Junior Talker

Posts: 4
Apache on Windows 2003 SP2.

Lets say I have a site that is accessible by these URL's:

http://somelocalsvr/directory
http://192.168.1.1/directory

I want to redirect all requests that come via 192.168.1.1 to a subdirectory, ie. http://192.168.1.1/directory > http://192.168.1.1/directory/subdirectory

So I have this rule:

Code:
RewriteCond %{HTTP_HOST} ^192.168.1.1
RewriteCond %{REQUEST_URI} !^/directory/subdirectory(.*)$
RewriteRule ^/directory(.*)$ /directory/subdirectory$1 [R]
This works fine, but I don't want to show /subdirectory in the URL. I want it to transparently pass the request to /directory/subdirectory, like a pass-through.

Is there any way I can achieve this?

Thanks in advance for any help...
papastreets is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 05-10-2008, 05:27 PM Re: RewriteRule help
chrishirst's Avatar
Super Moderator

Posts: 10,642
Location: Blackpool. UK
unless yours is the first or only site on the IP. HTTP requests for the IP won't even get as far as .htaccess.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-10-2008, 10:09 PM Re: RewriteRule help
Junior Talker

Posts: 4
Thanks for the reply, but can you explain it a little further?

FYI at this point the rule about does work as expected, but I don't want to show the subdirectory in the resulting URL.
papastreets is offline
Reply With Quote
View Public Profile
 
Old 05-10-2008, 11:30 PM Re: RewriteRule help
tamar's Avatar
Ultra Talker

Posts: 433
Name: Tamar Weinberg
Location: New York
Quote:
Originally Posted by chrishirst View Post
unless yours is the first or only site on the IP. HTTP requests for the IP won't even get as far as .htaccess.
I think he's talking about an intranet setup -- like for users in his office. So I'm not sure if that makes a difference.
tamar is offline
Reply With Quote
View Public Profile Visit tamar's homepage!
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to RewriteRule help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.14821 seconds with 14 queries