I currently have wordpress pages that that can be viewed via both the index page (all the posts) and also the category pages.
My current permalink structure is ‘http://www.mysite.com/%postname%/‘ which is neat and i would like to keep.
Current examples..
Home page (post list)
http://www.mysite.com/
Category page (filtered post list – filter on category)
http://www.mysite.com/categoryname/
Any post list needs to be order (by choice of the user) by any of the following parameters…
Oldest->Newest , Newest->Oldest , Expensive->Cheapest , Cheapest->Expensive , HighestRated->LowestRated , LowestRated->HighestRated
I have handled all the sorting correctly in the functions.php and it retrieves from from GET parameter set. (the last 4 are custom meta attributes which I have sorted/handled correctly)
Examples are…
http://www.mysite.com?SortBy=Newest
http://www.mysite.com/categoryname?SortBy=HighestRated
I can’t get a correct functioning .htaccess file with ModRewrite that achieves this….
I would like them to look like these (for the 2 examples above)
http://www.mysite.com/SortBy/Newest/
http://www.mysite.com/categoryname/SortBy/HighestRated
My webserver is running Apache on Linux server.
My current .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
It doesn’t seem to be doing my current re-write actions but I presume these are handled by WordPress elsewhere??
Use the add_query_arg WordPress function. WordPress is designed to reject any URL query parameters that it doesnât recognize. You will need to tell WordPress about the new parameter(s) you will be sending via a URL.
Reference:
http://codex.wordpress.org/Function_Reference/add_query_arg
“Retrieve a modified URL (with) query string.
You can rebuild the URL and append a new query variable to the URL query by using this function. You can also retrieve the full URL with query data.”