maxidrom11
August 9th, 2008, 06:20 AM
I want to remove www. in mydomain.com using 301 redirect with .htaccess but it doesnt work for some reason :confused:
In my Apache 2. all needed .htaccess directives enabled I guess
mod_rewrite is enabled - I am sure
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
I set up Virtual hosting for mydomain.com
DocumentRoot "/var/www/path"
ServerName mydomain.com
ServerAdmin webmaster@domain.com
<Directory "/var/www/path">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
my .htaccess file looks like this:
DirectoryIndex index.php
<FilesMatch .\.php>
ForceType application/x-httpd-php
</FilesMatch>
Options -MultiViews -Indexes +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^adser|ref|product\.php - [L]
RewriteCond $1 !(\.css)|(\.js)|(\.ico)|(\.swf)|(\.jpg)|(\.png)|(\ .gif)|(^widgets.*)$ [NC]
RewriteRule ^(.*)$ index.php [QSA,NC,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]
I dont understand why it doest redirect my site from www.mydomain.com to mydomain.com
In my Apache 2. all needed .htaccess directives enabled I guess
mod_rewrite is enabled - I am sure
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
I set up Virtual hosting for mydomain.com
DocumentRoot "/var/www/path"
ServerName mydomain.com
ServerAdmin webmaster@domain.com
<Directory "/var/www/path">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
my .htaccess file looks like this:
DirectoryIndex index.php
<FilesMatch .\.php>
ForceType application/x-httpd-php
</FilesMatch>
Options -MultiViews -Indexes +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^adser|ref|product\.php - [L]
RewriteCond $1 !(\.css)|(\.js)|(\.ico)|(\.swf)|(\.jpg)|(\.png)|(\ .gif)|(^widgets.*)$ [NC]
RewriteRule ^(.*)$ index.php [QSA,NC,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]
I dont understand why it doest redirect my site from www.mydomain.com to mydomain.com