2014-08-29 5 views
0

내 URL에는 두 개의 변수가 있습니다. 이 내 홈 URL입니다 ->subdomain.example.com/subdirectory/abc.phpurl을 htaccess를 사용하여 변경하면서 url의 두 변수

가능한 경우 변수,이 같은 URL ->subdomain.example.com/subdirectory/abc.php? m = p & n = q abc.php 페이지는 이러한 변수를 가져 와서 다른 콘텐츠를 생성합니다.

나는 htaccess를 사용하여 정상적으로 작동합니다. 내가 같은 URL을 변경해야합니다 ->subdomain.example.com/subdirectory/p/q

문제는 사이트 것은

를 들어 privacy.php 일부 페이지 contact.php 같은 분리 된 페이지를 가지고 페이지 것을, 나는 변경할 필요가있는 URL을 같은 subdomain.example.com/subdirectory/contact subdomain.example.com/subdirectory/privacy

내가 URL을 subdomain.example에 들어갔을 때 .com/subdirectory/contact, abc.php가 첫 번째 변수 (m) = contact를 얻고 있습니다.

나는 그것을 중지하고 htaccess를 사용하여 URL을 변경해야합니다. 도와주세요. 고맙습니다. 당신의 /subdirectory/에 htaccess로 파일 이러한 규칙을 추가

답변

0

시도 :

Options -Multiviews 
RewriteEngine On 

# Append the .php extension 
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.php -f 
RewriteRule^/%{REQUEST_URI}.php [L] 

# pass parameters to abc.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/?$ abc.php?m=$1&n=$2 [L,QSA] 
+0

하지 작동합니다. 어쨌든 도움을 주셔서 감사합니다. – webie9

관련 문제