httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "--[ UxBoD ]--" <ux...@splatnix.net>
Subject [users@httpd] mod_rewrite woes
Date Thu, 20 Jan 2011 20:00:33 GMT
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message