Re: mod_rewrite woes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi UxBoD

Can you confirm you have

RewriteCond
RewriteRule

for each of you domains, I believe if you write multiple RewriteCond, they all have to match for the Rule then to be run.
Try in separate pairs.

R

Mark


On 20 Jan 2011, at 20:00, --[ UxBoD ]-- wrote:

Hello all,

I am switching from LiteSpeed webserver to Apache and having a real issue with mod_rewrite.  First of all here are the details of apache:

Server version: Apache/2.2.17 (Unix)
Server built:   Jan 20 2011 16:15:22
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.4.2, APR-Util 1.3.10
Compiled using: APR 1.4.2, APR-Util 1.3.10
Architecture:   64-bit
Server MPM:     Prefork
 threaded:     no
   forked:     yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/usr/local/apache"
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

I have included the necessary module:

LoadModule rewrite_module     modules/mod_rewrite.so

and have tested that it works by touching a file called test.html and making it redirect to another site using the following .htaccess rule:

Redirect /test/test.html http://httpd.apache.org

Now the issue comes when I am trying to redirect a domain URL in the following formats:

http://somedomain.com
http://somedomain.co.uk
http://www.somedomain.co.uk

and wish them all to be re-written as:

http://www.somedomain.com

I have tried using the following rule:

RewriteCond %{HTTP_HOST} ^somedomain.co.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^somedomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.somedomain.co.uk$ [NC,OR]
RewriteRule ^(.*)$ http://www.somedomain.com/$1 [R=301,L]

But it always ends up just showing the domain I entered and not re-directing :(

Am I doing something really stupidly crazy as I do not have much more hair to pull out :) Looking for some kind assistance.
--
Thanks, Phil

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



Regards

Mark

You can view my current Wolters Kluwer tasks at:

You can view my calendar at:    You can subscribe to my calendar at:






Mark Wiltshire
Red Alert Consultants LTD
Director - Technical Web Consultant Flat 6
168 Tower Bridge Road
London
SE1 3LS
iPhone email: markjwiltshire@xxxxxx
IM: markjwiltshire@xxxxxxxxx Desk: 0208 247 1547





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux