[x]
Ever Worried about Missed / Lost Mobile Phone (or) Mobile Phone Theft ?
Use GinGly to Save your Mobile Numbers and Useful Messages
Limited Time Free Access .Hurry Up !!!
Login
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Resend Activation Email
|
Forgot your Password?
Join IT Acumens Discussion Zone Free!
Welcome,
Guest
. Please
login
or
register
.
September 02, 2010, 11:42:30 PM
Home
Search
Team
Calendar
Gallery
Contact
Downloads
GoogleTagged
Login
Register
IT Acumens Discussion Zone
»
Tech News
»
Programming Discussions for Engineers
»
Web Services in PHP
(Moderator:
VelMurugan
) »
A Typical Case - mod_rewrite: No More Endless Loops!
« previous
next »
Reply
Print
Register to comment on this topic
Pages: [
1
]
Author
Topic: A Typical Case - mod_rewrite: No More Endless Loops! (Read 264 times)
sukishan
Hero Member
Posts: 2918
Acumen
A Typical Case - mod_rewrite: No More Endless Loops!
«
on:
August 22, 2009, 07:18:15 PM »
Quote
A Typical Case
Lets start with an example.
We want to redirect all URIs to a PHP script. The redirection will be internal, so the client, for example, a browser, will not see that a redirection has occurred. To do this, we create in the document root an .htaccess file that contains these rules:
# Enable rewrite engine
Options +FollowSymLinks
RewriteEngine On
# Redirect internally all URIs to /index.php
RewriteRule .* /index.php [L]
However, this will not work itll freeze your Apache Web server. Why?
The problem is this line:
RewriteRule .* /index.php [L]
Simply put, that rule says Redirect all requests to /index.php.. That may sound like what we originally set out to achieve, but, in practice, we will not get the results we expect.
The following is what happens with a request for
www.example.net/path/to/
:
Phase A
The URI is /path/to/
RewriteRule will rewrite the URI from path/to/ to /index.php
An internal redirection will be made for /index.php
The internal redirection will be treated as a new request, so it will be parsed again (see phase b)
Phase B
The previous internal redirection, /index.php, will be processed again by the rewrite engine
RewriteRule will rewrite index.php to /index.php
An internal redirection will be made for /index.php
At this point the rewrite engine will run Phase B continuously and the Apache Web server will freeze.
Logged
A good beginning makes a good ending
Reply
Print
Register to comment on this topic
Pages: [
1
]
« previous
next »
IT Acumens Discussion Zone
»
Tech News
»
Programming Discussions for Engineers
»
Web Services in PHP
(Moderator:
VelMurugan
) »
A Typical Case - mod_rewrite: No More Endless Loops!