2016-08-30 6 views
0

이 공통적 인 문제를 처리하기 위해 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> 

답변

1

그것은 실제로 URL에서 .php, 그것은 리디렉션으로 작동 "제거"아니에요에게있어이

<a href="index.php"> 
<a href="about-us.php"> 

같은 URL의 수 있습니다. 즉, 다른 사용자가 귀하의 URL에 .php을 표시하지 않게하려면 모든 링크를 수정해야합니다.

<a href='www.example.com'>

<a href='www.example.com/about-us'>

<a href='www.example.com/blog'>

당신은 당신의 스크립트 내부의 모든 링크를 수정해야합니다.

관련 문제