• I have an HTML website with a blog (WordPress) page under a subdirectory.

    My goal here is to access pages with no trailing slash ie. *domain.com/blog*.

    I’ve successfully configured to remove trailing slash for other plain HTML pages but not on the WordPress page (*/blog*). It will return an error 403 if I visit (*/blog*). If I remove .htaccess under the WordPress directory, I can visit (*/blog*) but it redirects to (/blog/) with a trailing slash.

    This is my .htaccess from **root directory**:

    RewriteEngine on
    ErrorDocument 404 /error/error404.html

    DirectorySlash Off
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.html -f
    RewriteRule ^(.*)$ /$1/index.html [L]

    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.php -f
    RewriteRule ^(.*)$ /$1/index.php [L]

    This is the .htaccess from **Wordpress directory**:

    # BEGIN WordPress
    # The directives (lines) between “BEGIN WordPress” and “END WordPress” are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /blog/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>

    # END WordPress

    Is there something wrong with my .htaccess files?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Access WordPress site with no trailing slash’ is closed to new replies.