?
Solved

Page is not redirected using redirect in apache

Posted on 2013-12-11
5
Medium Priority
?
292 Views
Last Modified: 2013-12-19
hi,

I have implemented the mod_redirect in the httpd conf file.

Below is the source code.

<VirtualHost *:80>
    DocumentRoot /htdocs
      RewriteEngine On
      RewriteCond %{SERVER_PORT} 80
      RewriteRule (.*)/hello\.html$ http:localhost/contact_us.html [R=301,L]
</VirtualHost>

Now i run the code on browser
http://localhost/hello.html

The url is redirected but the page contact_us is not opened.The reason behind is
The url "http://localhost/" is appended to the "http:localhost/contact_us.html"
Below is displayed in the address bar.

http://localhost/http:localhost/contact_us.html

Please suggest how to solve the problem so that the url is redirected to

http:localhost/contact_us.html.
0
Comment
Question by:Rocking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:sulistyanto
ID: 39711742
try to set AllowOverride all

example :
   
 DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride all
        </Directory>

Open in new window

0
 

Author Comment

by:Rocking
ID: 39711761
tried as per suggestion but not working.
0
 
LVL 27

Assisted Solution

by:skullnobrains
skullnobrains earned 1336 total points
ID: 39715441
use either

RewriteRule (.*)/hello\.html$ http://localhost/contact_us.html [R=301,L]
(notice the missing // after http: )

or

RewriteRule (.*)/hello\.html$ /contact_us.html [R=301,L]
0
 
LVL 4

Assisted Solution

by:Ramakanta Sahoo
Ramakanta Sahoo earned 664 total points
ID: 39728834
try below:

RewriteRule ^hello\.html$  contact_us.html [R=301,L]
0
 
LVL 27

Accepted Solution

by:
skullnobrains earned 1336 total points
ID: 39728975
or rather
RewriteRule /hello\.html$ /contact_us.html [R=301,L]
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question