Forum Moderators: phranque

Message Too Old, No Replies

How to make a redirect to a new page

rewrite rules

         

venweb

1:05 pm on Jun 2, 2009 (gmt 0)

10+ Year Member



The below rewrite rules are not working on Apache webserver. Is there any error in the below rules?
Appreciate for quick reply
RewriteEngine on

RewriteCond %{HTTP:DECRYPTED} True
RewriteCond %{HTTP_HOST} ^www.ebank.ab112.us.abcd.com/* [NC]
RewriteCond %{HTTP_PORT} (.*)
RewriteRule ^/(.*) [localhost:%{HTTP_PORT}...] [R]

g1smd

1:23 pm on Jun 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There are plenty of obvious errors that I'll point out now, but there are also plently more that we can't tell you about because we don't know what that code is supposed to do compared with what it actually does.

The HOST_NAME should be just that. Lose the /* from the end.

If this code goes in .htaccess lose the leading slash from the pattern.

You have a 302 redirect, I assume you need 301.

Why are you redirecting requests for an external web-based domain name to a file inside the viewers own machine?

venweb

7:23 am on Jun 3, 2009 (gmt 0)

10+ Year Member



Thanks for the reply...

I do not want to confuse you sir..

Just I want a simple redirect from:

[localhost:1080...]
(where if this particular URL not accessible) then it should be redirected to our custom page: [localhost:1080...] using {HTTP_HOST}

Thanking you..

g1smd

8:13 am on Jun 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What is this bit for?

RewriteCond %{HTTP_HOST} ^www.ebank.ab112.us.abcd.com [NC]

Do you want to accept all port numbers in the request and redirect all of them to 1080 or only accept requests for 1080?

venweb

8:46 am on Jun 3, 2009 (gmt 0)

10+ Year Member



www.ebank.ab112.us.abcd.com is the external URL.

Actually we are trying to create a new webinstance and which Listen on PORT 1080. And which should verify the above external URL and If the URL is not available..then our custom page will show the friendly message.
At present testing on localserver. If works for localhost then we try for the above URL.

The default 8080 port is Listening. But we tried to create another virtualhost 1080. which should perform all the above tasks..

The redirect is required for all the ports.

venweb

8:57 am on Jun 3, 2009 (gmt 0)

10+ Year Member



we do not want to use the .htaccess. all should be in .conf file or extended(Included) file.