2013-05-25 3 views
2

나는 이런 내 웹 사이트에서 URL이 있습니다. 이 같은만드는 방법 꽤 URL을

내 기대 URL 뭔가 -

http://mydomain.com/centers/Tharanga-Higher-Educational-Institute#page=art-section 

지금까지 내 htaccess로 파일이 코드는

# Enable Rewriting 
RewriteEngine on 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /profiles/centers/index.php\?code=([0-9]+)&name=([^&]+)&?([^\ ]+) 
RewriteRule ^profiles/centers/index\.php /%1/?%2 [R=301,L,NE] 

하지만이 코드는 나를 위해 작동하지 않습니다. 누군가가 나를 도울 수 있기를 바랍니다. 감사합니다.

+0

리디렉션이 필요없는 깨끗한 URL이므로 현재 환경에서'http : // www.mydomain.com/profiles/centers /'와'Tharanga + Higher + Educational + Institute # page = 예술 섹션' – Vector

답변

4

이 당신의 코드를 바꿉니다 : 당신이 그것을 잘 작동하는지 확인되면, R=301R=302을 대체

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+profiles/centers/index\.php\?code=([^&]+)&name=([^&\s]+) [NC] 
RewriteRule^/%1/%2? [R=302,L,NE] 

RewriteCond %{ENV:REDIRECT_STATUS} !200 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^([^/]+)/([^/]+)/?$ /profiles/centers/index.php?code=$1&name=$2 [L,NC,QSA,NE] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule \.(js|css|jpe?g|gif|png)$ /profiles/centers/%{REQUEST_URI} [NC,L,R=302] 

. mod_rewrite 규칙을 테스트하는 동안 R=301 (영구 리디렉션)을 사용하지 마십시오.

+0

코드로 확인했습니다. 이제이 오류를 얻을 수 있습니다 massege -'Object not found! 요청한 URL을이 서버에서 찾을 수 없습니다. 추천 페이지의 링크가 잘못되었거나 오래된 것 같습니다. 해당 페이지의 작성자에게 오류에 대해 알려주십시오. 서버 오류라고 생각되면 웹 마스터에게 문의하십시오. 오류 404' – TNK

+0

무슨 뜻인지 알 수 있습니까? – TNK

+0

리디렉션 후 브라우저에 표시되는 URL은 무엇입니까? – anubhava

관련 문제