I have .htaccess file which I am using to remove .php extensions and apply some 'vanity' to a folder. I am also trying to add custom error pages. I am not very familer with htaccess at all and have only ever used it to redirect a user. I have this so far
RewriteEngine ON
# hide php extentions
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC]
#vanity on a directory
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ http://localhost/ownitall/profile.php?user=$1 [NC]
#Error Handling
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php
There are two main probelms with this: 1: The error handling does not work at all, if a page doesn't exist anyway I just redirected to profile.php.
RewriteRule ^(.*)$ http://localhost/ownitall/profile.php?user=$1 [NC]
So far example if i was to go to page /about-us/sub-folder/ - which doesn't exist I would get redirected to profile.php.
* EDITED * //PROFILE.php document
<?php if(isset($_GET)){
print_r($_GET);
}?>
To further exlpain - If i went to page '/about/index' in the site I get this output, which comes from profle.php
Array ( [user] => about/index.php/index )
Instead of my error handling document. * EDITED *