Php htaccess mod_rewrite-子文件夹类型为长URL

Php htaccess mod_rewrite-子文件夹类型为长URL,php,mod-rewrite,Php,Mod Rewrite,我现在用的是, RewriteEngine On RewriteBase / RewriteRule ^blahblah/([a-z]+)$ abcd.php?word=$1 [L] 因此,当前输出为site.com/blahblah/word 我想实现的是,site.com/blahblah/the-word-is-word 到处搜索,什么都找不到这是怎么回事:( 例如: 原始url:site.com/abcd.php?word=Google 目前:site.com/blahblah/Go

我现在用的是,

RewriteEngine On
RewriteBase /

RewriteRule ^blahblah/([a-z]+)$ abcd.php?word=$1 [L]
因此,当前输出为site.com/blahblah/word

我想实现的是,site.com/blahblah/the-word-is-word

到处搜索,什么都找不到这是怎么回事:(

例如:

原始url:
site.com/abcd.php?word=Google

目前:
site.com/blahblah/Google

我要找的是:
site.com/blahblah/这个词就是谷歌


注:大写确实很重要,因为谷歌和谷歌将有所不同。

将此代码放在.htaccess的文档根目录下:

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

# external redirect to blahblah/the-word-is-google.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+abcd\.php\?word=([^\s]+) [NC]
RewriteRule ^ blahblah/the-word-is-%1.html? [L,R,NC]

# internal redirect from blahblah/the-word-is-google.html to abcd.php?word=google
RewriteRule ^blahblah/the-word-is-([a-z]+)\.html$ abcd.php?word=$1 [L,NC,QSA]

将此代码放在.htaccess的文档根目录下:

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

# external redirect to blahblah/the-word-is-google.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+abcd\.php\?word=([^\s]+) [NC]
RewriteRule ^ blahblah/the-word-is-%1.html? [L,R,NC]

# internal redirect from blahblah/the-word-is-google.html to abcd.php?word=google
RewriteRule ^blahblah/the-word-is-([a-z]+)\.html$ abcd.php?word=$1 [L,NC,QSA]

如果您将[a-z]改为(.*),您将能够重定向所有字符,这样:单词is word也将传递给?word=No,您误读了问题。例如,输入是google。实际url:
site.com/abcd.php?word=google
我实际需要的:
site.com/blahblah/如果您更改[a-z],单词就是google
进入(*)您将能够重定向所有字符,以便:单词is word也将被传递到?word=否,您误读了问题。例如,输入是google。实际url:
site.com/abcd.php?word=google
我实际需要的:
site.com/blahblah/wordis google
添加了代码。现在发生的是,当我转到abcd.php?w时ord=google,它加载大约5秒钟,然后重定向到正确的url,并给出该url。Firefox检测到服务器正在以一种永远不会完成的方式重定向对此地址的请求。立即生效。:)如果您可以再次修改它,使其成为.html:)的最终url扩展名,那就太好了。谢谢,伙计:)非常欢迎您。我编辑了我的答案,使其URL扩展名为
.html
。添加了代码。现在发生的是,当我转到abcd.php?word=google时,它会加载大约5秒钟,然后重定向到正确的url,并给出以下内容。Firefox检测到服务器正在以一种永远不会完成的方式重定向对此地址的请求。立即生效。:)如果您可以再次修改它,使其成为.html:)的最终url扩展名,那就太好了。谢谢,伙计:)非常欢迎您。我编辑了我的答案,使其URL扩展名为
.html