Tuesday, 15 January 2013

apache - RewriteRule redirect all to index.php when folder exist -



apache - RewriteRule redirect all to index.php when folder exist -

in server have

.htaccess

errordocument 403 index.php rewriteengine on rewriterule ^(.*)$ index.php?rec=$1 [l,qsa] index.php

folder1

.htaccess='deny all'

folder2

.htaccess='deny all'

folder3

.htaccess=''

folder4

.htaccess=''

i want redirect index.php, work all, when seek on existing folders no .htaccess, without slash, this:

domain.com/folder3domain.com/folder4

it redirect to

domain.com/folder3 -------> domain.com/folder3/?rec=folder3 domain.com/folder4 -------> domain.com/folder4/?rec=folder4

but whant this

domain.com/folder1 -------> domain.com/folder1/ .......ok domain.com/folder2 -------> domain.com/folder2/ .......ok domain.com/folder3 -------> domain.com/folder3/ .......not work, domain.com/folder3/?rec=folder3 domain.com/folder4 -------> domain.com/folder4/ .......not work, domain.com/folder4/?rec=folder4 domain.com/folder1/ -------> domain.com/folder1/ .......ok domain.com/folder2/ -------> domain.com/folder2/ .......ok domain.com/folder3/ -------> domain.com/folder3/ .......ok domain.com/folder4/ -------> domain.com/folder4/ .......ok

the question this: why if folder haven't "deny all" redirect differ when link him without slash, , how solve problem, redirected index.php on root folder.

apache .htaccess mod-rewrite url-rewriting url-redirection

No comments:

Post a Comment