LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-09-2007, 09:57 AM   #1
griffey
Member
 
Registered: Jan 2004
Location: East Central Illinois
Distribution: RHEL 4/5/6 and Fedora
Posts: 89

Rep: Reputation: 15
Problem with Apache rewrite


Hi folks.

Sorry to trouble you all with something that seems even to me to be rather simple, but I've spent two days and still can't get it to work properly.

I have three slightly-different domain names that all point to the same web directory via virtual hosts.

What I want to do is have two of the three "turn into" the first one, and I think I can do that using mod_rewrite, if I'm not mistaken.

I've read the Apache docs, searched the web, searched through these forums, and still cannot get this to work.

Here's what I want to do:

I want xxxxx.org and www.xxxxx.org to always turn into www.yyyyy.org.

So here's what I added to httpd.conf:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^xxxxx\.org [NC]
RewriteRule ^/.* http://www.yyyyy.org%{REQUEST_URI} [R,L]

I've tried it with and without the ! on the second line, because I've seen it both ways. I've tried ^(.*)$ instead of ^/.* on the third line, because I've seen it both ways. I've also had /$1 instead of %{REQUEST_URI} because I've seen that differently as well.

I've tried commenting out the virtual host entry for xxxxx.org, but that didn't help.

Surely I'm making a simple mistake....

I'd appreciate any and all suggestions.

Thanks in advance.

Mike
 
Old 08-10-2007, 06:19 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Did you check the logs in /var/log/apache? Those are very verbose and tell you exaclty what is going wrong with your rewrite. If I am not mistaken, there is a setting in the httpd.conf which can even increase the verbosity for rewriting.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache rewrite help deesto Linux - Server 3 11-03-2006 02:07 PM
Need help with Apache rewrite kinetik Linux - General 6 05-19-2006 06:02 AM
Apache 2 Rewrite One Domain To Another thunder04 Linux - Software 10 04-19-2006 01:38 AM
apache mod rewrite Robert0380 Linux - Software 5 07-31-2003 04:42 PM
Apache rewrite question CrazyToon Linux - Software 3 06-17-2003 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration