2012-04-25 16 views
0

こんにちは、私はこれを使用していますが、notfound.phpにリダイレクトされているためにhtaccessが動作していることがわかりましたが、何らかの理由で拡張機能(php/html)ここに?htaccess拡張子を削除する

<Files ~ "^\.(htaccess|htpasswd)$"> 
deny from all 
</Files> 
Options Indexes 
ErrorDocument 404 notfound.php 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(www\.socialscenes\.co\.uk)(:80)? [NC] 
RewriteRule ^(.*) http://socialscenes.co.uk/$1 [R=301,L] 
DirectoryIndex index.php  
order deny,allow 

答えて

1

さて、あなたは.php.html拡張子を隠すサポートするために持っているものよりもはるかに多くを必要とします。このコードを考えてみましょう:

httpd.confを通じてのmod_rewriteと.htaccessを有効にしてから.htaccessDOCUMENT_ROOT下のディレクトリにこのコードを配置:

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
RewriteBase/

## hide .php or .html extension 
# To externally redirect foo.php ot foo.html to foo 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.(php|html) [NC] 
RewriteRule^%1 [R,L,NC] 

## To internally redirect /dir/foo to /dir/foo.html 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteRule^%{REQUEST_URI}.html [L] 

## To internally redirect /dir/foo to /dir/foo.php 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule^%{REQUEST_URI}.php [L] 
関連する問題