2014-07-21 4 views
1

내 문제는 내가 http://example.com/admin/이라고 입력하면 올바르게 작동하며 $_GET['decode']에 올바른 정보가 포함되어있어 문제가있을 수 있습니다. 그러나 http://example.com/admin (슬래시 제외)을 입력하면 내 URL이 http://example.com/admin/?decode=admin으로 리디렉션되고 모든 것이 엉망입니다. 누군가 나를 도울 수 있습니까?URL 끝의 슬래시 .htaccess

여기 내 .htaccess입니다 : mod_dirmod_rewrite에 의해 실행되는 마지막 규칙 후 디렉토리 URI (/admin) 뒤에 슬래시를 추가하기 때문에

RewriteEngine on 
Options +FollowSymlinks 

<FilesMatch "(config.php|defines.php|functions.php)"> 
    Order Allow,Deny 
    Deny from all 
</FilesMatch> 

Header set X-UA-Compatible "IE=Edge,chrome=1" 

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L] 

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

RewriteRule ^([^\.]+)$ ./index.php?decode=$1 [L,QSA] 

php_value date.timezone "Europe/Bratislava" 

답변

2

그것은이다.

이 코드보십시오 :

DirectorySlash Off 
RewriteEngine on 
Options +FollowSymlinks 

<FilesMatch "(config.php|defines.php|functions.php)"> 
    Order Allow,Deny 
    Deny from all 
</FilesMatch> 

Header set X-UA-Compatible "IE=Edge,chrome=1" 

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
RewriteRule^http://%1%{REQUEST_URI} [R=301,NE,L] 

## Adding a trailing slash 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{THE_REQUEST} \s/+(.*?)[^/][?\s] 
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/?$ ./index.php?decode=$1 [L,QSA] 

php_value date.timezone "Europe/Bratislava" 
+0

죄송합니다,하지만이 – debute

+0

지금 시도 잘 작동하지 않습니다. 상단에'DirectorySlash Off'를 추가했습니다. – anubhava

+0

새 브라우저에서 여전히'/ admin /? decode = admin' – debute

관련 문제