0

In my config file, I have:

$config['url_suffix'] = "/"; 

Here is my .htaccess:

    Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}      ^.+[^/]$
RewriteRule ^(.+)$              $1/   
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 

When I load a page, I don’t get the trailing slash. I am using URI routing, but even when I go to the actual path of the controller/view, I still don’t get the trailing slash.

What am I doing wrong? I tried removing the slash after the .php in the last line of the .htaccess, but that didn’t do it.

Even if I add “.html” as my URL suffix, it doesn’t get added. And that’s not in my .htaccess.

If I try to make $route['news-and-events'] = "news"; this instead: $route['news-and-events/'] = "news"; I get a 404 error

EDIT: With the above .htaccess I get an error that I am using disallowed characters, even when I add "/" to my allowed characters string in the config file.

2
  • Take a look: stackoverflow.com/questions/2390310/… Commented Jan 4, 2011 at 16:04
  • Please see above. I tried to incorporate that solution into my .htaccess, but was not successful, despite trying to remove several of the conditions. Commented Jan 4, 2011 at 16:18

1 Answer 1

1

Found a one that worked for me, Imported my Blogger posts to my Wordpress, and then my back links didn't work, so I just replaced my .htaccess with this example, check it out!

http://www.high-on-it.co.za/2011/02/removing-trailing-html-from-url/

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_URI} \.html$

RewriteRule ^(.*)\.html$ $1 [R=301,L]

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.