25
If you`re using some kind of CMS, usually its normal that each URL works with or without trailing slash, e.g. these URLs would be the same:
http://example.org/about
http://example.org/about/
Still Google, Yahoo, MSN and other search engines treat them as different urls and gives penalty as they are dupliate URLs with identical content.
You have two options - to add or to remove the trailing slash. After a bit of reading I chose to remove the slash from my celica site, because I`m using Drupal CMS that removes trailing slashes for new content and I don`t really want to hack the CMS plugins. To alter the URLs, you need to edit .htaccess file at the root directory of your website ( http://example.org/.htaccess )
Add this code to your .htaccess file to remove trailing slashes:
#get rid of trailing slashes
RewriteCond %{HTTP_HOST} ^(www.)?turbocelica\.lv$ [NC]
RewriteRule ^(.+)/$ http://www.turbocelica.lv/$1 [R=301,L]
or use this code to ADD trailing slash to the end of each URL:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)([^/])$ http://example.org/$1$2/ [R=301,L]
Make sure you backup your .htaccess file before you edit. It`s easy to get “500 Internal server error” if you don`t know what you`re doing ;)
Read more here: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
I’ve a link : subdomain.abc.com.vn/foulder/
I want to change to : subdomain.abc.com.vn/foulder/
The same with subdomain.abc.com.vn/foulder1/foulder2/ => subdomain.abc.com.vn/foulder1/foulder2
Can you help me with .htaccess file, please?
I’ve a link : subdomain.abc.com.vn/foulder/
I want to change to : subdomain.abc.com.vn/foulder
The same with subdomain.abc.com.vn/foulder1/foulder2/ => subdomain.abc.com.vn/foulder1/foulder2
Can you help me with .htaccess file, please?
try this:
#remove trailing slashes
RewriteCond %{HTTP_HOST} !^\.yourdomain\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
i hate hijacking sounds dirty and bad thnx for article