I've been tasked with modifying an existing Wordpress site with URL rewriting. Problem is I've never done this before. I know these rules should go in a .htaccess
file in root with something like this in it:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
However, I have no clue as to how I should specify the rules and conditions for rewriting. I've tried to read up on the mod_rewrite guide, but my somewhat lacking technical abilities limits my comprehension.
Here are the URLs that need rewriting and the desired results:
Generic blog post URL
www.example.com/?p=X
= www.example.com/blog/custom-post-title/
Specific pages
www.example.com/?page_id=2
= www.example.com/about/
www.example.com/?page_id=4
= www.example.com/bloggers/
www.example.com/?page_id=10
= www.example.com/results/
Generic blogger profile
www.example.com/?author=X
= www.example.com/blogger/author-name/
Any help with this would be greatly appreciated. Thanks in advance!
You are reverse thinking: you rewrite input URL to match your filesystem.
So you want to rewrite
www.example.com/blog/custom-post-title/
towww.example.com/?p=X
For all your pages, go from specific to generic.
I have a little doubt on the last rule, since you don't use filename for redirection (rewrite on /) it may make a new request to
index.php?<thequerystring>
so we would have to exclude index.php from the last rewrite to avoid infinite loops :Can be added in front of all others.
Wordpress should be able to do this for you in the permalinks section of the settings.
Failing that, if it can not write directly to your .htaccess file it should give you something to copy and paste.
The only issue I can see is the use of "blogger" instead of author. That you may need to correct, if you see it as important enough.
More Info