2014-10-22 4 views
0

나는 항상 .htaccess로 엉켜서 누군가가 나를 쓸 수있게되기를 바랬다. 내가 원하는 무엇에 물건을 온라인으로 유사한 발견,하지만 난 자신의 재 작성을 다시 작성하기에 충분 확신하지 않다 : P예쁜 URL .htaccess

을 내가 원하는이 :

/foo/ = index.php?a=foo 
/foo/bar/ = index.php?a=foo&b=bar 
etc. up to /foo/bar/baz/cat/dog/ (&e=dog) 

나는 또한이기 위하여 index.php를 원하는 /index.php가 /로 재 작성되도록 보이지 않음.

또 다른 것은, 나는 내가 이것을 싶지 않아/예 : 이미지 /와 같은 디렉토리가 ... 항상 후행 슬래시 할 수 있으므로 능력 있을

/foo/bar/baz/?another=whatever 

싶습니다 적용, 그래서 내가이 백인 목록을 만들 필요가 있을까요 또는 내가 사용할 수있는 특정 리디렉션이 있습니까?

건배!

+0

시도한 코드는 무엇인가요? –

답변

0

디렉토리를 허용 목록에 추가 할 필요가 없습니다. 그것은 RewriteConds가하는 것입니다.

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

실제 파일 또는 실제 디렉토리가 아닌지 확인한 후 RewriteRule을 수행합니다.

아래의 규칙을 .htaccess 파일에서 사용해보십시오.

RewriteEngine On 
RewriteCond %{REQUEST_URI} /+[^\.]+$ 
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) index.php?a=$1&b=$2&c=$3&d=$4&e=$5&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+) index.php?a=$1&b=$2&c=$3&d=$4&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/([^/]+) index.php?a=$1&b=$2&c=$3&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+) index.php?a=$1&b=$2&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+) index.php?a=$1&%{QUERY_STRING} [L] 
+0

리다이렉팅 index.php 이외에 다른 튜토리얼에서 방금 얻은 것 : https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html – Varrick