Question

I'm trying to figure out how to disallow any strings in my URL (I had a problem with an old host allowing ?PHPSESSID strings) and want to avoid any pages with a string to get indexed. Here is my current .htaccess. I've tried a few rules in the beginning that didn't work. Any other thoughts that might force strings back to the last segment?

http://pastie.org/pastes/8660658/text

Était-ce utile?

La solution

Have it this way:

RewriteEngine On
RewriteBase /

## force a trailing slash ##
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301]

# strip all query strings
RewriteCond %{QUERY_STRING} .+
RewriteRule ^ %{REQUEST_URI}? [L,R=301]

## BEGIN Expression Engine Rewrite ##

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]

## END Expression Engine Rewrite ##
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top