Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a fresh Wordpress install in a subdirectory:

/blog/

I visit my Wordpress site like this:

http://www.example.com/blog

and posts like this:

http://www.example.com/blog/category/postname

In general settings I have the "WordPress Address & Website URL" set to:

http://www.example.com/blog

Permalinks is set to:

http://www.example.com/blog/%category%/%postname%

In the subdirectory (/blog/) I have an .htaccess like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

Everything works fine, I can see posts, categories... everything.

The only problem is: if I add a trailing slash /

ie: http://example.com/blog/category/postname/ The browser send me a redirect loop error.

I've tried everything, the only solution I've found is to disable redirect_canonical like this :

remove_filter('template_redirect', 'redirect_canonical');

Now there is another problem: this solution leave many duplicate content possibilites, and my post can be seen by two different URL (one with / and the other one without /).

How can I make that canonical works with my installation?

PS: The server is linux apache, not IIS.

PS2: If I change my permalink structure to /%category%/%postname%/ + flush url, in order to allow trailling slash, I've got the exact same problem when I type and remove the last slash in my address URL.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.