Need help with friendly URL's in Wordpress
I'm creating som custom templates in Wordpress and I'm passing some data in the URL's.
Currently my URL looks like this: http://www.mysite.com/designers/?id=43&name=designer+name
The URL contains designer ID and designer name.
I would really like to use this: http://www.mysite.com/designers/designer+name/
My permalink structure is set to /%category%/%postname%/
My .htaccess file looks like this:
# 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
I've looked at http://codex.wordpres开发者_如何学Gos.org/Using_Permalinks, but not become any wiser.
I got two questions:
- Is there any point in changing the above URL regarding SEO
- How can I get the "pretty" URL?
Steven, quite an interesting topic. I went through it last year on my real estate project in WordPress. There are tonnes of ways to apply some customizations to your permalinks, including all the new features in WordPress 3.0 and above, but as I figured out, the key is of course to sort of "hard-code" them.
In WordPress it's done pretty much the same way as you would do it in Apache, only with a few exceptions. Read through the WP_Rewrite article, it should pretty much explain everything. With this approach I managed to get permalinks like this:
domain.com/browse/
domain.com/browse/country/
domain.com/browse/country/region/
domain.com/property/country/region/property-name/
Where country
and region
are one custom taxonomy which is hierarchical. It took me a while but it seems to work fine now, even with the latest changes to the core code.
精彩评论