2011-11-21 1 views
2

다음 RewriteRule의 지금 모든 domain.com/something-here회사에 간다 제대로수정은

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301] 

를 작동 -profile.php

어떻게 해결할 수 있습니까?

첫째, domain.com/login 은 로그인 폴더의 index.php에로 이동합니다. 나는 (배경)에 다시 보여줍니다 domain.com/login 작성하는 경우
나는, 두 번째 RewriteRule의를 입력 할 때 회사 profile.php CNAME = 로그인

+1

의도 한 효과는 무엇입니까? 첫 번째가 언제 일어나야하는지, 두 번째 때와 안되는 이유에 대한 예를 들려주십시오. – mario

+0

@mario 그랬어 .. – EnexoOnoma

+1

'abc'에서 /profile/company-profile.php로,'abc'에서'/ $ 1 /'로 리다이렉트 했으니 누가 먼저 오는지 누가 알 겠어? –

답변

3

내가 이것을 사용하는 것이 좋습니다?

RewriteEngine On 
RewriteBase/

# redirect company specific request 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([a-z0-9\-_]+)/?$ profile/company-profile.php?cname=$1 [NC,L] 

# redirect all others 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteCond %{REQUEST_URI} !/?$ 
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301] 
+0

내가 갖고 싶지 않다. 회사는 부분이 – EnexoOnoma

+0

이 되니'([a-z0-9 \ -_] +)'가 profile/company로 리다이렉트하고'(. *)'를 다른 모든 것에 리다이렉트하고 싶습니까? –

+0

폴더가 리다이렉트되어 있으면 발견하고, 그렇지 않으면 company-profile.php에 없으면 – EnexoOnoma

관련 문제