Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache mod_rewrite

Status
Not open for further replies.

nezboid

Programmer
Mar 4, 2003
4
GB
I am trying to use the Apache mod_rewrite module to rewrite a URL in the httpd.conf fileas follows:

RewriteRule &quot;^/$&quot; &quot;<my URL> [L]&quot;

However, this issues a 'Redirect' - with a HTTP status code of '302', which slows the process down.
I want Apache to process this request internally so that no Redirect is created, only a forward to the new URL. I would expect this to create an HTTP status code of '200' & not 302.
Is this possible & if so, how?
 
I'm no guru, but if you change &quot;/index.html&quot; to &quot;/top/index.html&quot;, that's a 302 redirect that the browser must know about. I don't think mod-rewrite can bypass that &quot;rule&quot;. Mod-rewrite plus mod-proxy _can_ do that by hiding the &quot;real&quot; directory from the client.
 
could you explain how mod_rewrite in combination with mod_proxy can achieve this. I'd like to be more certain before I go down the route of rebuilding my Apache install with mod_proxy,
thanks
 
my question:
what exactly is
<my URL> in
RewriteRule &quot;^/$&quot; &quot;<my URL> [L]&quot; ?

if <my URL> is on trhe same server...
you dont need mod_proxy.
If you want to use mod_proxy:
RewriteRule &quot;^/$&quot; &quot;<my URL> [L,P]&quot;

BTW: the corect syntax is
RewriteRule ^/$ <my_URL> [L,P]

but with mod_proxy the apaci will be slower,slower,slower


__
___
 
<myURL> is on the same server.
However, when I use the RewriteRule I get a status '302' each time in the log, which is a redirect. Is it not possible to have Apache process Rewrite internally & forward on to the URL rather than redirecting the browser?

If you could provide a simple example that I can test to see an internal URL that would be most helpful
 
This problem is sorted now, thanks for everyone's help.
I did need to have the 'mod_proxy' module because my URL was going off to another server, causing the 'redirect'.
(That's why you wanted to see the URL 'predamarcel' :))

With the mod_proxy in place & inserting [P,L] at the end of my URL the HTTP status code went to desired '200'.
 
before you said: `<myURL> is on the same server.'

you can skip the proxy module if your <my_URL> are on te same server.

I use this (without mod_proxy) every day...
depends how look your <my_URL>

__
___
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top