1

as you may know zend framework uses .htaccess for redirection purposes

so when I tried to follow this advice: http://techpp.com/2010/06/28/how-to-redirect-www-urls-to-non-www-urls-and-non-www-to-www/

in conjuction with the necessary .htaccess code for zend framework, the redirection works fine, but zend stopped working properly...

does anyone know how to achieve this task without messing up zend framework

current rules:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

1 Answers1

2

I have something similar in a project of mine. The following redirects a non-www requests to a www request:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com$ 
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

A similar thing should work for redirection from www to non-www:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.example\.com$ 
RewriteRule (.*) http://example.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
DavidW
  • 166
  • 3
  • 9