2014-12-02 3 views
1

리디렉션이 제대로 작동하지 않아서 여기에 갇혀 있습니다. 그것은 디렉토리와 HTML 파일에서 작동하지만 PHP 파일은 리디렉션하지 않습니다.리디렉션 301은 HTML에서는 작동하지만 PHP 파일에서는 작동하지 않습니까?

제발 누군가 내 오류를 poinout하십시오. 감사. mod_alias 사람과 mod_rewrite 규칙을 혼합

ErrorDocument 404 http://www.domain.com/404.php 
<ifModule mod_headers.c> 
    <FilesMatch "\.(jpg|jpeg|png|gif|ico|pdf|pdf|xml|txt|css|js)$"> 
    Header set Cache-Control "max-age=604800, proxy-revalidate" 
    </FilesMatch> 
</ifModule> 
<ifModule mod_expires.c> 
    ExpiresActive On 
    ExpiresDefault A259200 

    ExpiresByType image/gif A2592000 
    ExpiresByType image/png A2592000 
    ExpiresByType image/jpg A2592000 
    ExpiresByType image/x-icon A2592000 
    ExpiresByType image/jpeg A2592000 
    ExpiresByType application/pdf A2592000 
    ExpiresByType application/x-javascript A604800 
    ExpiresByType text/plain A604800 
    ExpiresByType text/css A604800 
</ifModule> 

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} ^domain\.com [NC] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] 

Redirect 301 /page.html /page/page.php?title=page 
Redirect 301 /page/ /page.php 
#^works 
Redirect 301 /page/index.php /page/page.php 
Redirect 301 /page/page.php /page/page.php?title=page 
#^doesnt work throws 404.php page 
+0

어떤 URL을 시도해 보았습니까? – anubhava

+0

코드 하단에 게시했습니다. – HelpNeeder

+0

리디렉션 301 /test.php/communities/all-communities.php <<<<< doesnt work --- work >>>> 301 /test.html/communities/all-communities.php 리디렉션 – HelpNeeder

답변

1

마십시오. 이러한 규칙을 시도해보십시오

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,NE,R=301] 

RewriteRule ^communities/hamilton-info\.html$ /communities/community.php?title=Hamilton+Square [L,QSA,NC,R=302] 
RewriteRule ^homesforsale/?$ /rtmi.php [L,NC,R=302] 
#^works 

RewriteRule ^communities/index\.php$ /communities/all-communities.php [L,NC,R=302] 
RewriteRule ^communities/covington-map\.php$ /communities/community.php?title=Covington [L,QSA,NC,R=302] 
#^doesnt work throws 404.php page 

/communities/ 폴더에는 htaccess로이없는 것을 확인.

+0

시도해 봅니다. 여전히 HTML이 작동하며 PHP는 그렇지 않습니다. 당신이 옳다는 것이 확실합니다.이 문제가 발생하면 서버 제공 업체에 연락하겠습니다. – HelpNeeder

관련 문제