내 htaccess
파일에 다음과 같은 내용이 있습니다. 난 할 노력하고있어 domain.com/whatever
를 통해이 htaccess가 올바른 다시 쓰기입니까?
domain.com/index.php/view/whatever
accessable 한을 또한 non www
에서 www
로 리디렉션하는 것입니다.
이 URL은 index.php/view
인 모든 URL에서 작동하지만 이제는 index.php/view
이없는 다른 URL은 작동하지 않습니다. 예 : domain.com/index.php/site/pages
은 index.php/view
이 없으므로 더 이상 작동하지 않습니다.
htaccess가 index.php/view
이 아닌 다른 URL에만 영향을 주길 원합니다. 이 문제를 해결하려면 무엇을해야합니까?
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/view/$1 [L]
RewriteCond %{http_host} ^domain.com [nc]
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
업데이트. 사물을 좁히려면 어떻게 두 규칙을 같이 할 수 있습니까? 요청이 http://domain.com/index.php/site/pages 같은 것을하려 할 경우, 나는 당신이 그것을 그대로 통과 할, 그러나 http://domain.com/whatever처럼 뭔가 있다면, 당신은 그것을 다시 얻을하려는, 그래서 그들에게 모두
RewriteRule ^(.*)$ /index.php/view/$1
RewriteRule ^(.*)$ /index.php/site/$1
없음이되지 않습니다 그것을 해결하십시오. 질문 범위를 좁히려면 어떻게'RewriteRule^(. *) $/index.php/view/$ 1'과'^ (. *) $/index.php/site/$ 1' 규칙을 둘 다 가질 수 있을까요? 나는 단지 그들 중의 1 명을 가지고있는 것처럼 보일 수있다. 둘 다 필요해. – Pinkie
나는 둘 다 가질 수 있다고 생각하지 않는다. 아마도'RewriteRule^site /(.*)$/index.php/view/$ 1'와'RewriteRule^view '과 같은 것을해야 할 것이다. /(.*)$/index.php/site/$ 1' – lfxgroove
각 URL을 두 가지 방식으로 다시 작성할 수는 없으며 mod_rewrite는 올바른 방법을 알 수 없습니다. – user1064663