This question is an exact duplicate of:
I would like to know how I can add a slash at the end of all my URLs? I already use a .htaccess to remove the .php extension using this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
and I'd like a slash at the end of all my URLs, now. Here is my index.php file:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "index") !== false) { ?>
<title>Test - Forums</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "members") !== false) { ?>
<title>Test - Members</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "sign_up") !== false) { ?>
<title>Test - Sign Up</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "sign_in") !== false) { ?>
<title>Test - Sign In</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "change_theme") !== false) { ?>
<title>Test - Change Theme</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "contact_us") !== false) { ?>
<title>Test - Contact Us</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "help") !== false) { ?>
<title>Test - Help</title>
<?php } ?>
<?php
if(strpos($_SERVER["SCRIPT_FILENAME"], "rules") !== false) { ?>
<title>Test - Rules</title>
<?php } ?>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include("top_bar.php");?>
<?php include("header.php");?>
<?php include("container.php");?>
<?php include("footer.php");?>
</body>
</html>
and my top_bar.php:
<!-- TOP BAR -->
<div id="top_bar">
<div class="wrapper">
<div id="top_bar_links">
<ul>
<?php
$full_name = $_SERVER["PHP_SELF"];
$name_array = explode("/",$full_name);
$count = count($name_array);
$page_name = $name_array[$count-1];
?>
<li>
<a id="home" href="../">Home</a>
</li>
<li>
<a id="forums" class="<?php echo ($page_name=="index.php")?"active":"";?>" href=".">Forums</a>
</li>
<li>
<a id="members" class="<?php echo ($page_name=="members.php")?"active":"";?>" href="members">Members</a>
</li>
</ul>
</div>
</div>
</div>
All my files en placed in a folder called "community": http://prntscr.com/487rhj
How can I do, please?
Thanks.
</div>