PHP页面没有加载; Wordpress接管404

时间:2013-09-10 03:35:55

标签: php wordpress

我有一个问题,当我尝试在浏览器中加载某个.php页面时,在安装了Wordpress的域中,Wordpress会抛出404而不是页面本身。

问题页面是:

http://healthysurprise.com/special/sign-up?product=healthy

你可以在这里看到模拟页面(只需删除'/ special'):

http://healthysurprise.com/sign-up?product=healthy

php需要URL字符串才能动态加载页面。该页面是“sign-up.php”并在目录中。我错过了什么?

注意:
- 已安装wordpress
- index.php在两个位置都加载正常 - 无论目录是什么,它似乎都是这样做的 - 之前有一个名为'注册'的WP页面模板,但我刚删除它

这是我的.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
RewriteRule ^/([^-]*)$ /$1.php

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

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

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

</IfModule>

# END WordPress

1 个答案:

答案 0 :(得分:0)

我弄明白了这个问题。它在.htaccess文件中。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
RewriteRule ^/([^-]*)$ /$1.php

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

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

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

</IfModule>

# END WordPress

Wordpress的最高规则是将所有内容都搞砸了。通过删除或注释掉它们,无论用户是调用/ foo还是/foo.php,都会加载普通页面

这是有效的.htaccess文件

# BEGIN WordPress
<IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteBase /blog/
# RewriteRule ^index\.php$ - [L]
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /blog/index.php [L]
# RewriteRule ^/([^-]*)$ /$1.php

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

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

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

</IfModule>

# END WordPress