Hi, Can some bright spark help me with a problem. I have about 40 of the pages of a directory in Googles index on the non-www domain as well as with www. domain. I understand seo and use 301's regularly when a problem like this shows up but when I add the code to my htaccess file to send anything at non-www to www.domain it only works on my details pages but not any of the category or sub category pages, on these pages the non-www address just redirects to index.php instead of the page with www. Here is the code I added ( i have removed the domain) RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] I think the problem is the line above but I dont know how to fix it! Any ideas? Steve ################################################# ## PHP Link Directory - Apache Server Settings ## ################################################# # Protect files <Files ~ "^(.*)\.(inc|inc\.php|tpl|sql)$"> Order deny,allow Deny from all </Files> # Protect directories <Files ~ "^(backup|files|images|include|lang|libs(/.+)?|temp(/.+)?|templates(/.+)?|javascripts(/.+)?)$"> Order deny,allow Deny from all </Files> # Disable directory browsing Options -Indexes # Follow symbolic links in this directory Options +FollowSymLinks # Override PHP settings that cannot be changed at runtime # (If your server supports PHP settings via htaccess you can comment following two lines off) # php_value register_globals 0 # php_value session.auto_start 0 # Customized error messages # ( If you are running in a subfolder please add it, example: "directory/index.php?httpstatus=404" ) ErrorDocument 404 index.php?httpstatus=404 # Set the default handler DirectoryIndex index.php # URL rewrite rules <IfModule mod_rewrite.c> RewriteEngine On ## Details Link Page Rewrite## RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)detail/link-(.*).html$ detail.php [QSA,NC] ## Pagination Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)page-(\d+)\.html$ $1/?p=$2 [PT,NC] ## Category redirect RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php [QSA,L] RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] </IfModule>
Hi Thanks for trying, entered your suggestion and it does the same thing, if i select a page and remove the www. and press refresh it redirects to domain/index.php
Okay try again with this: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] ## Details Link Page Rewrite## RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)detail/link-(.*).html$ detail.php [QSA,NC] ## Pagination Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)page-(\d+)\.html$ $1/?p=$2 [PT,NC] ## Category redirect RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php [QSA,L] </IfModule>
Superstar you are VimF .. Hats off to you. Worked perfectly. I am using phpld 3.3 if anyone else finds this post!
can anybody help me in this... on my php link directory website.. urls are not coming acc. to SEO friendly.. although these are .html files bt not SEO friendly... in article title name is not coming in url.. and same with links please tell me how to solve this.. -- I have already enable the SEO url- on from backend.. this is what i have in my .ht access file --- ################################################# ## PHP Link Directory - Apache Server Settings ## ################################################# # Prevent .htaccess and .htpasswd files from being viewed by web clients <Files "^\.ht"> Order allow,deny Deny from all </Files> # Protect files <Files ~ "^(.*)\.(inc|inc\.php|tpl|sql)$"> Order deny,allow Deny from all </Files> # Protect directories <Files ~ "^(backup|files|images|include|lang|libs(/.+)?|temp(/.+)?|templates(/.+)?|javascripts(/.+)?)$"> Order deny,allow Deny from all </Files> # Disable directory browsing Options -Indexes # Follow symbolic links in this directory Options +FollowSymLinks # Override PHP settings that cannot be changed at runtime # (If your server supports PHP settings via htaccess you can comment following two lines off) # php_value register_globals 0 # php_value session.auto_start 0 # Customized error messages # ( If you are running in a subfolder please add it, example: "directory/index.php?httpstatus=404" ) ErrorDocument 404 index.php?httpstatus=404 # Set the default handler DirectoryIndex index.php # URL rewrite rules <IfModule mod_rewrite.c> RewriteEngine On #Make sure RewriteBase points to the directory where you installed phpLD. #Example: "/phpld" if your installation is in a "phpld" subdirectory. #RewriteBase / ##Latest Links Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^latest-links\.htm[l]?$ index.php?list=latest [QSA,NC,L] ##Top Hits Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^top-hits\.htm[l]?$ index.php?list=top [QSA,NC,L] ##Latest Articles Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^latest-articles\.htm[l]?$ index.php?list=latestarticles [QSA,NC,L] ##Details Link Page Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)detail/link-(.*)\.htm[l]?$ detail.php [QSA,NC] ##Article Page Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)articles/article-(.*)\.htm[l]?$ article.php [QSA,NC] ##Author Page Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)authors/author-(.*)\.htm[l]?$ author.php [QSA,NC] ##Pagination Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)page-[0-9]+\.html$ index.php [QSA,NC,L] ##Pages redirect RewriteCond %{REQUEST_URI} !page-[0-9]+\.html?$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)\.html$ page.php?name=$1 [NC,QSA,L] ##Category redirect RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule .* index.php [QSA,L] --