[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Page is not redirected using redirect in apache

Posted on 2013-12-11
5
Medium Priority
?
294 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

656 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