이 공통적 인 문제를 처리하기 위해 StackOverflow에서 많은 솔루션을 발견했지만 설치에 아무런 효과가없는 것으로 보입니다. 나는 PHP 페이지로 연결했을 때 나는 여전히 .PHP 확장자를보고 내가 폴더 '웹 사이트'내부/로컬 호스트를 WAMP 사용하여 사이트 일하고.htaccess를 사용하여 .php 확장자를 제거하는 규칙을 다시 작성하십시오.
index.php updated to 'website'
about-us.php to be website/about
하고 싶습니다. 내 .htacces 파일은 'website'폴더의 루트 안에 있습니다.
index.php와 다른 PHP 페이지에서 .php 확장자를 제거하기 위해 사용하려는 재 작성 조건/규칙은 다음과 같습니다.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
내 링크는 여기에 전체 htaccess로 파일
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
여기에서'index.php' 대신'index'에 직접 링크 할 수 있습니다. '이것을 사용하십시오. –
@ Abhishek. 감사. 우리는 하나의 유스 케이스에 대해 알고 있지만 .php 확장자로 모든 페이지를 수정하는 방법을 알고 있습니다. – George