2012-11-11 3 views
0

이 많이 발생합니다. 일부 htaccess 규칙에 대한 도움이 필요합니다. 실마리는 사용자가 실제 URL이 www.mydomain.com/results.html/sth 일 때 답을 얻지 만 자신의 브라우저에서 www.mydomain.com/sth 만 볼 수 있고 집으로 리디렉션해야합니다. 페이지 (www.mydomain.com/index.html)의 URL은 www.mydomain.com이어야합니다.HTACCESS - 간단한 mod_rewrite 규칙을 적용하면

감사

+0

했나를 너는 내 제안을 아래에 시도해. ? – Sameh

답변

0
#this is for the www.yourdomain.com/index.html 
RewriteRule ^$ index.html [L] 
RewriteRule ^/$ index.html [L] 

#this is for the results 
RewriteRule ^([^/]+)$ results.html?$1 
RewriteRule ^([^/]+)/$ results.html?$1 
+0

감사합니다. results.html에서는 작동하지만 불행히도 홈페이지 index.html에서는 그렇지 않습니다. www.mydomain.com/index.html 또는 www.mydomain.com/에 대한 링크는 www.mydomain.com/index.html 또는 www.mydomain.com/으로 이동하지만 www.mydomain.com/results.html의 콘텐츠를 표시합니다. . –

0

와 코드의 처음 3 줄 바꾸기 : 작동합니다

+0

아직 내가 전에 설명한 것과 같은 것은 없습니다. www.mydomain.com/에 대한 링크는 저를 데려가지만, 불행히도 www.mydomain.com/results.html에서 제공됩니다. –

0

하지만

DirectoryIndex index.html 

은 기본적으로 일을해야 :

RewriteEngine On 
RewriteCond %{REQUEST_URI} !^/(results|index)\.html 
RewriteCond %{REQUEST_URI} !^/?$ 
RewriteRule ^(.*)$ /results.html/$1 

RewriteRule ^index\.html$/[R=301,L]