Rewrite Rule looping error


 
Thread Tools Search this Thread
Top Forums Web Development Rewrite Rule looping error
# 8  
Old 09-14-2012
I couldn't get a rewrite-loop with your version. Perhaps your apache configuration is different. But try this:

Code:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.html$ index.html?NEW=1

It will rewrite it only when the query string is blank.
# 9  
Old 09-15-2012
Hi Corona688,

Sorry for the inconvenience caused, I tried ur rule and my page was not redirecting. And my previous rule causing the infinite looping(Attached a screenshot for your reference)

I tried in google chrome to make sure its not a browser issue - No luck same looping error....

Im using version: Apache/2.2.3 linux
OS Centos 5.7 (Final) 32 bit


Regards
Paulwintech
Rewrite Rule looping error-errorjpg

Last edited by Paulwintech; 09-15-2012 at 12:30 AM..
# 10  
Old 09-15-2012
That's because it's not a redirect. It's a rewrite. Your browser asks for index.html and gets handed index.html?NEW=1. It doesn't actually tell your browser about it.

Perhaps something in your webpage -- which I'm assuming is actually a CGI script since it takes GET requests -- is causing the redirect.
# 11  
Old 09-15-2012
* How to redirect the page... Is there any other option to make apache to redirect the page? rather then rewrite

* Im not using any CGI script for GET request in server

Sorry if my above questions is silly....

Regards
Paulwintech
# 12  
Old 09-15-2012
Quote:
Originally Posted by Paulwintech
Im not using any CGI script for GET request in server
If nothing cares whether you make a GET request or not, why bother adding ?NEW=1 ? Smilie You don't actually have a file named index.html?NEW=1 do you? That's not going to work, the web browser considers everything after the ? as the query string for a GET request.

You really, really ought to figure out what's redirecting your webpage in the first place before you try redirecting the redirected redirect! You're just going to put a redirection loop inside a redirection loop...

Last edited by Corona688; 09-15-2012 at 05:36 PM..
# 13  
Old 09-17-2012
With rewrite rules in sendmail and apparently Apache, sometimes you need to go somewhere else to avoid looping rule 1, and use rule 2 to come back. Good luck.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Error in looping through files

Hi, I've got a folder with several files I'd like to manipulate. The file names are all ending in .txt and I'd like to loop through their names for manipulation. This is the script I've got so far: for i in 'ls *.gtc.txt|cut -d "." -f1'; do echo${i}; done It should be easy enough, but... (2 Replies)
Discussion started by: zajtat
2 Replies

2. Web Development

ReWrite rule giving a hard time.

Hi all, I am trying to find a rewrite rule that can help me with the following situation. So I am currently on a page which has a URL: http://www.test.mobile.com/#!/shop/phones/max-plus/features/ Now when I hover over a certain link, I can see that it will goto: <a... (0 Replies)
Discussion started by: Junaid Subhani
0 Replies

3. UNIX for Advanced & Expert Users

[SOLVED] htaccess rewrite rule help!

hi there, I need that when user input mysite.com/ponuka/AAA2869 it shows mysite.com/ukaz.php?ponuka=AAA2869 because of facebook likes, and I found out that this is set up as rewrite rule in .htaccess file? how to achieve it? thank you... :confused: ---------- Post updated at 04:47... (0 Replies)
Discussion started by: vogueestylee
0 Replies

4. Shell Programming and Scripting

multiple looping with case and funtion showing error, Please help

Hello All, I have code as follows :- while true do {opening a case1 statement} 1) {opening another case2 statement} {closing case 2} 2) Showing error for "2)" as Syntax error at line 59 : `)' is not expected. *) {closing case 1} ... (5 Replies)
Discussion started by: Renjesh
5 Replies

5. UNIX for Advanced & Expert Users

Apache rewrite rule help needed

Hi All, I want to redirect from http://localhost/abc/xyz/def?cc=dk&lc=da to http://localhost/abc/mnc/pdf?cc=dk&lc=da. Please suggest a rewrite rule. (0 Replies)
Discussion started by: jagnikam
0 Replies

6. Web Development

Need help with rewrite rule

Hi, I hosted my site on Apache web server. I wanted to redirect all the users request to a HTML page(maintenance page). I used the below rewrite rule to do ths same. RewriteEngine on RewriteRule .* /maintenance.html The maintenance.html page contains an image. When ever I try to... (2 Replies)
Discussion started by: BSrikanthB
2 Replies

7. Web Development

.htaccess Rewrite Rule

Hello All, I have been asked to create a .htaccess redirect. I have never attempted to work with one of these files. We have a pretty vanilla LAMP setup using rhel4 apache1.3 and php4.2.3. I was instructed to place the .htaccess file in the document root of the site and and to attempt to... (1 Reply)
Discussion started by: jaysunn
1 Replies

8. Shell Programming and Scripting

grep help, how do i rewrite this

Thanks , franklin you method worked, i knew i had to use a while loop and getline in there just didnt know the proper order :) Hi everyone, im trying to make the following command line shorter by introducing a script that join up all the grep commands ./new1a < numbers.txt | grep -i -v '^a '... (5 Replies)
Discussion started by: weezybaby
5 Replies
Login or Register to Ask a Question