user1083644
user1083644

Reputation: 23

removing forward slash in .htaccess

I am using Jobbersbase for my online job portal. In which i have given link to my main webpage page like this http://www.mydomain.com/aboutus.html, but its not working because the link is taking '/' at the end http://www.mydomain.com/aboutus.html/

I tried adding RewriteCond %{REQUEST_FILENAME}\.html -f in .htaccess , if i add that other links doesnt work which has / for example http://www.mydomain.com/jobs/

Now my .htaccess looks like this

# AddType x-mapp-php5 .php
# AddHandler x-mapp-php5 .php

    RewriteEngine On
RewriteCond %{REQUEST_URI} .*/$
RewriteRule (.*)/$ $1



ErrorDocument 404 /page-unavailable/

<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>

Someone please suggest me how to do it thanks

Upvotes: 0

Views: 195

Answers (1)

Chris Hayes
Chris Hayes

Reputation: 12030

Perhaps it isn't as easy as I imagine, but:

RewriteEngine On
RewriteCond %{REQUEST_URI} .*/$
RewriteRule (.*)/$ $1

With modifications for the specific files/directories you care about, if necessary. See below:

RewriteEngine On
RewriteCond %{REQUEST_URI} .*aboutus\.html/$ [or]
RewriteCond %{REQUEST_URI} .*contact\.html/$
RewriteRule (.*)/$ $1

This should strip trailing slashes from those specific pages only. Unfortunately I can't verify this because I'm having trouble getting my .htaccess working with my virtual host configuration.

Upvotes: 1

Related Questions