Php GoDaddy上的Wordpress URL参数

Php GoDaddy上的Wordpress URL参数,php,wordpress,mod-rewrite,Php,Wordpress,Mod Rewrite,我目前正在制作一个网站() 它在Godaddy上托管,我使用wordpress作为CMS 我希望能够: http://tannernelson.me/ehs/school/academics/teachers/jsmith 变成 http://tannernelson.me/ehs/index.php?pagename=teachers&detail=jsmith 因此,基本上,如果url有4个段(学校/学术界/教师/jsmith),我希望最后一个段是一个变量。因此,任何url的第四

我目前正在制作一个网站()

它在Godaddy上托管,我使用wordpress作为CMS

我希望能够:

http://tannernelson.me/ehs/school/academics/teachers/jsmith
变成

http://tannernelson.me/ehs/index.php?pagename=teachers&detail=jsmith
因此,基本上,如果url有4个段(学校/学术界/教师/jsmith),我希望最后一个段是一个变量。因此,任何url的第四段都是变量“detail”

我当前的URL重写正在进行

# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ehs/index.php [L]
Options -Multiviews
即使使用默认的WordPress.htaccess文件,它也无法以任何其他方式工作。我不知道这意味着什么,也不知道它发出了什么样的请求URI。真让人困惑


有什么想法吗?

您现在拥有的代码意味着:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
如果请求的文件名不是常规文件
-f
),如果请求的文件名不是目录
-d
,则:

RewriteRule . /ehs/index.php [L]
匹配任何单个字符(
),如果找到匹配项,请将URL重写为
/ehs/index.php
,然后将其作为最后一条规则(
[L]
),因此不处理任何进一步的规则

这看起来不像你想要的,但似乎有效<代码>http://tannernelson.me/ehs/school/academics/teachers/jsmith提供(我想)
http://tannernelson.me/ehs/index.php
因为我得到了一个自定义的404未找到页面

请尝试以下
.htaccess
代码:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# Redirect the ehs/school/academics/$1/$2 URIs to /ehs/index.php?pagename=$1&detail=$2
RewriteRule ^ehs/school/academics/([^/]+)/([^/]+)$ /ehs/index.php?pagename=$1&detail=$2 [L]

# Otherwise if the requested URI is not found (not a file nor a directory)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#Redirect everything else to index.php
RewriteRule .* /ehs/index.php [L]

Options -Multiviews
我刚刚在我的Apache服务器上测试了它,它可以正常工作