I want to remove ALL trailing slashes on file names, NOT directories on a php driven site
How to do that? As I have tried multiple htaccess edits and none work
latest is RewriteCond %{HTTP_HOST} ^(www.)?mywebsite\\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
and I did change website to mine
The site is designed as follow
- each page name has a folder page1… > index.php inside which calls includes files header.php, footer.php, navbar.php and > contents folder > page1.php
SAMPLE of page1.index.php file
<?php
// Edit the following three lines of code. '$a' adjusts the relative paths of the page. '$current" tells the Nav Bar what the current page is. '$thisPageContent' match the filename in the includes > 6.content folder.
$a = '../';
$current = 1;
$thisPageContent = 'page1.php';
// Do not change the following line of code. You can go into the '0.seo.php' file to edit SEO content.
include ($a . 'includes/0.seo.php');
// Edit the following three lines of code. You will want to match the variables after the equals sign to the variables in '0.seo.php'.
$thisPageTitle = $page1Title;
$thisPageKeywords = $page1keywords;
$thisPageDescription = $page1Description;
?>
<?php
include ($a . 'includes/1.doctype.php');
?>
<head>
<?php include ($a . 'includes/2.header.php'); ?>
<title><?=$thisPageTitle?></title>
<meta name="keywords" content="<?=$thisPageKeywords?>">
<meta name="description" content="<?=$thisPageDescription?>">
</head>
<body>
<?php
include ($a . 'includes/3.top.php');
include ($a . 'includes/4.navbar.php');
include ($a . 'includes/6.content/' . $thisPageContent );
include ($a . 'includes/7.footer.php');
?>
</body>
</html>
The problem is every single page has a trailing slash behind it, directories and normal page names.
I want www.website.com/page1/
to be
www.website.com/page1
and this solution did not work:
RewriteCond %{HTTP_HOST} ^(www.)?mywebsite\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
- RewriteRule ^(.*)/+$ $1 [R=301,L]
htaccess
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site.com
AuthUserFile /home/bolo/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/bolo/public_html/_vti_pvt/service.grp
ErrorDocument 404 http://www.site.com/404
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule (.*) http://www.site.com/$1 [R=301,L]
order allow,deny
deny from
94.100.22.210
213.238.175.8
188.143.232.31
188.143.232.111
allow from all
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
and I don’t know why FrontPage is in there at the top for this site.