2017-06-09 10 views
0

DuplicateリダイレクトのURL

リダイレクト.PHPとのリンクをリダイレクトしないhtaccessファイルを使用するの.php

の.htaccess

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
# browser requests PHP 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php 
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301] 

# check to see if the request is for a PHP file: 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^/?(.*)$ /$1.php [L] 
</IfModule> 

# END WordPress 
無し

それでも私はexample.com/example.phpが404

任意のアイデアや提案にリダイレクトすることを見ることができましたか?

答えて

1

ディレクティブの順序を変更する必要があります。使用:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 

# browser requests PHP 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php 
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301] 

# check to see if the request is for a PHP file: 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^/?(.*)$ /$1.php [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
+1

ありがとうございました...それが助けになりました! –