.HTACCESS网址重写-4个简单的重写规则不起作用(GoDaddy + WordPress)
我想知道我的重写规则是否不正确,因为它们在我的Godaddy共享服务器上不起作用?
我有四个非常基本的.htaccess URL重写规则. 每当用户键入/单击链接时:
I have four very basic .htaccess URL rewrite rules. Whenever the user types/clicks on the link:
-
漂亮的SEO(所需)链接
http://www.electriccarlos.com/albums/
实际上是http://www.electriccarlos.com/type/audio/
漂亮的SEO(所需)链接http://www.electriccarlos.com/discography/
实际上是http://www.electriccarlos.com/type/audio/
Beautiful SEO (desired) link http://www.electriccarlos.com/discography/
is actually http://www.electriccarlos.com/type/audio/
漂亮的SEO(所需)链接http://www.electriccarlos.com/gallery/
实际上是http://www.electriccarlos.com/type/gallery/
Beautiful SEO (desired) link http://www.electriccarlos.com/gallery/
is actually http://www.electriccarlos.com/type/gallery/
漂亮的SEO(所需)链接http://www.electriccarlos.com/videos/
实际上是http://www.electriccarlos.com/type/video/
Beautiful SEO (desired) link http://www.electriccarlos.com/videos/
is actually http://www.electriccarlos.com/type/video/
.htaccess文件:
# BEGIN Omar Juvera
RewriteEngine On
# albums
RewriteRule ^albums/?$ type/audio/ [NC,L]
RewriteRule ^discography/?$ type/audio/ [NC,L]
# gallery
RewriteRule ^gallery/?$ type/gallery/ [NC,L]
# videos
RewriteRule ^videos/?$ type/video/ [NC,L]
# END Omar Juvera
# 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]
</IfModule>
# END WordPress
.htaccess
文件已正确配置,并且RedirectMatch
处于活动状态.
The .htaccess
file is properly configured and RedirectMatch
is active.
好吧,您在最高规则中所做的任何事情都只会被WordPress覆盖:RewriteRule . /index.php [L]
Well, anything that you do in your top rules is simply being overwritten by the WordPress: RewriteRule . /index.php [L]
将所有内容重写为/index.php
,现有文件和目录除外.
Which rewrites everything to /index.php
except for existing files and directories.
您将不得不很好地与WordPress对话,并要求它为您做到这一点!如果您不知道该怎么做,建议您再提出一个有关如何使用WordPress的问题.
You're going to have to speak very nicely to WordPress and ask it to do this for you! If you don't know how to do that I suggest starting another question about how to do this with WordPress.