Hi there, I'm currently rewriting my dynamic urls using mod_rewrite which is working fine. I'm just wondering how best to handle pages that don't exist. Right now it works by getting the page id and displaying the content, if the pageid doesn't exist it displays a custom 404 message. What I would like to do is change the url so that it displays a generic 404 url instead of the not found one. This is my htaccess file:
RewriteEngine on
Options -Indexes
RewriteBase /
# Disable rewrite for specific directories
RewriteCond %{REQUEST_URI} !^/admin/
# Disable rewrite for specific directories
RewriteCond %{REQUEST_URI} !^/portal/
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/\.]+)/?$ index.php?id=$1 [L]
# Disable rewrite for specific directories
RewriteCond %{REQUEST_URI} !^/admin/
# Disable rewrite for specific directories
RewriteCond %{REQUEST_URI} !^/portal/
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?id=$1&code=$2 [L]
RewriteRule ^admin/([^/\.]+)/?$ admin/error.php?err=3 [R=301,L]
So when the $_GET["id"] query returns a rowCount of 0 from the database it sets the pageid to 404 and pulls the 404 message from the database. But the url is still the non-existant page and I'd like to change that if possible. I'm just not sure how.