Disclaimer : know nothing about mode rewriting
I'v a simple .htacces the code is below:
Options -Indexes
ErrorDocument 404 /filenotfound.php
RewriteEngine On
RewriteBase /
### hide .php extension snippet
## To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} \s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R=302,L,NE]
## add a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301,NE]
## To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
I've some internal redirection, if user successfull logged in it should redirect to another folder's index file. it was work fine before adding this .htaccess
file.
This is how i'm redirecting :
function redirectTO($url = null){
if($url != null){
header("Location:{$url}");
exit();
}
}
redirectTO('agent/index.php');
EDIT: Redirection has stopped working after adding that mode rewrite code. i don't know if i need all of that code I've copied from a another stack overflow post. if you think some of the .htaccess code is irrelevant please feel free to advise on that too.
By the way I've also added this <base href="/" />
line aswell in my html in <head>
section. I don't know what is the issue seems to be any Idea?