0

I need vanity urls, how can i make them redirect to the custom 404 page if they are not found in my DB?

.htaccess code

ErrorDocument 404 /url/notfound.php

RewriteEngine On  
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^(\w+)$ code.php?code=$1
Cody
  • 1,281
  • 2
  • 10
  • 12
  • 2
    I see you redirect everything to `code.php`, where you checking if such URL does exist in your DB. If such URL does not exist use the same or similar code as in your `notfound.php` to display 404 page (send 404 header + nice page describing that no such URL found here -- that's how a lot of programs does it --e.g. WordPress etc). – LazyOne Jul 16 '11 at 10:18
  • oh, i didn't think about that, i was searching for htaccess solutions :\, thanks – Cody Jul 16 '11 at 15:58

0 Answers0