wordpress url重写alpha数字分页

时间:2011-12-21 07:48:31

标签: wordpress url-rewriting url-routing

我有一个aplhanumeric分页,并希望有漂亮的URL

在页面上http://www.mysite.com/glossary/

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | G | H |我| J | K | L | M | N | O | P |问| R | S | T | U | V | W | X | Y | Z

Apple
Alicia
Amy
A sweet Candy
.
.
.
.
and so on

aplha数字上的当前网址有一个http://www.mysite.com/glossary/?list=a  我希望有这个

的网址
http://www.mysite.com/a
http://www.mysite.com/b
http://www.mysite.com/c
and so on.. .

关于如何在.htacess url重写中对此进行编码以实现该网址的任何想法?

更新

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

# END WordPress
RewriteEngine on
RewriteRule ^/mysite/([^/\.]+)/?$ glossary/?list==$1 [L]

由于

2 个答案:

答案 0 :(得分:0)

尝试

RewriteEngine On
RewriteRule ^([^/]*)\.html$ /glossary/?list=$1 [L]

答案 1 :(得分:0)

经验法则:对于不那么复杂的规则来说,总是最复杂的。

试试这个并告诉我它是否有效:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /mysite/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([0-9a-z]{1})$ glossary/?list=$1 [NC,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /mysite/index.php [L] 
</IfModule>

如果不起作用,请尝试:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /mysite/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/([0-9a-z]{1})$ glossary/?list=$1 [NC,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /mysite/index.php [L] 
</IfModule>