Forum Moderators: phranque
2 days ago I had to move from shared hosting to dedicated server - my own boss now - also my own workhorse - too much traffic / CPU usage emailed me my host (1and1.com) ....
with previous apache 1.3 and php4.4 --- ALL worked perfectly!
now I have apache 2.2 and php5 and nothing at all work re rewriting
<snip>
about 70% of my pages are static HTML pages - rest dynamic PHP pges
before i had several mod_rewrite on my site - all in .htaccess - some simple some quite complex and all worked perfectly all times
with exactly same mod_rewrite syntax as before - on new server NO mod_rewrite works at all even the most simple.
I had / have from hotlink rewrite to domain.com ->> www.domain.com - and complex mod rewrite for my gallery2 photo gallery SW - all worked perfectly before
apache2 is new to me and it appears somehow that i have set at least ONE option or configuration too few ( ... or too much? )
in the apache global conf httpd.conf ( in my suse linux its default_server.conf )
I have the module mod_rewrite loaded - at least php-info says so
and i have enabled
Options MultiViews All ( where "All" should include all incl. option followsymlinks )
Options +FollowSymlinks
the most simple code i used before in .htaccess - NOW in the global conf - was
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$
http://www.example.com/$1 [L,R=301] syntax test says:
> rcapache2 configtest
Syntax OK
any idea what to do to make mod_rewrite system wide working again?
any particular technique to migrate all working mod_rewrite code from apache 1.3 to apache 2.2?
help highly appreciated - i have spent the last 2+ days nearly day and night searching G and reading apache2 howtos and manuals with no success so far
[edited by: jdMorgan at 1:45 pm (utc) on Oct. 26, 2006]
[edit reason] Examplified, removed specifics per TOS. [/edit]
Your code may work better as
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule [b]^/([/b].*)$ http://www.example.com/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.co[b]m$1[/b] [L,R=301]
Also, remember that any changes you make to the server config files won’t take effect until after a server restart.
Jim