I'm having issues with my website and database. I created a pages
table where I want to use the page title
as the path, for instance.
http://website.com/page-title/
I'm using a .htaccess file with:
# BEGIN
<IfModule mod_rewrite.c >
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule >
# END
But it's not working? Do I need to create directory folders?
Push all requests to an index page and then that page will send to the browser only. Your server $_SERVER['REQUEST_URI']
should change but should always run through the index.php
page:
/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [NC,QSA,L]
/index.php
<?php
// You should see the REQUEST_URI change here.
print_r($_SERVER);