Jump to content
Steven Koontz

[FAQ] Redirecting JReviews pages in .htaccess

Recommended Posts

Steven Koontz

I was originally going to post only about my experience making the switch from JReviews URL parameters to Joomla URL parameters. However, I believe this space would be better to compile a general list of useful redirects for common (and not-so-common) JReviews pages.

 

My idea is to start out with some redirects I set up to make the switch from Jreviews' /param:val to Joomla's &param=val. I would welcome the community to post their own redirects and also ask questions. Any contributions or solutions I will then add to the general list of useful redirects in this first post. That way, no-one will ever have to sift through pages and pages of posts looking for a needle in a haystack.

 

The difference between JReviews and Joomla URL parameters.

Here is an example of the same URL for a JReviews paginated List Page using the two different parameters:

 

Joomla Parameters:

domain.com/category?page=3

 

JReviews Parameters:

domain.com/category/menu/page:3/

 

You can see that the difference is in the paginated part of the URL. Joomla uses an appended query string, while JReviews uses a more "folder-looking" approach.

 

Similar parameters are added to URLs as a result of filtering with Custom Fields, ordering and filtering by media types and/or owners.

 

I recently made the switch from JReviews to Joomla parameters and took some precautionary measures both in .htaccess (redirects) and robots.txt (blocking undesired pages such as ordering and other filters). Here is the gist of what I did. In all cases remember that media codes such as m: and page:3 I used a real code from my site. However, the redirects work for any media code or page. The rewrite rules grab and "save" that part of the url and rewrite it conserving the media ID or page number the user is on.

 

Media pages

Old url: domain.com/multimedia/photos/m:lPQL6/

New url: domain.com/multimedia/photos?m=lPQL6

RewriteRule ^multimedia/photos/m:(.*)/$ /multimedia/photos?m=$1 [R=301,L]

Remember to enter your own catch-all media menu alias and image, video, attachment or audio subfolder.

 

My Media Pages

Old url: domain.com/my-media/menu/user:42/

New url: domain.com/my-media?user=42

RewriteRule ^my-media/menu/user:(.*)/$ /my-media?user=$1 [R=301,L]

 

In the following category redirects try to grasp the pattern in the use of the ([A-Za-z0-9-]+) string. That query basically grabs any segment of a url and rewrites it as-is. In this way you can redirect hundreds of different categories with just one line of code in .htaccess.

 

Category or Custom List

Old url: domain.com/category/menu/page:3/

New url: domain.com/category?page=3

RewriteRule ^([A-Za-z0-9-]+)/menu/page:(.*)/$ /$1?page=$2 [R=301,L]

 

Directory-dependent Category List

These are pages that have the following structure: directory -> category

Old url:  domain.com/nightlife/pubs/menu/page:3/

New url: domain.com/nightlife/pubs?page=3

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/menu/page:(.*)/$ /$1/$2?page=$3 [R=301,L]

 

Multiple Nested Category List

These are pages that have the following structure: directory -> category -> subcategory

Old url:  domain.com/travel/accomodation/hotels/menu/page:3/

New url: domain.com/travel/accomodation/hotels?page=3

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/menu/page:(.*)/$ /$1/$2/$3?page=$4 [R=301,L]

 

Click2Search pages

Old url: domain.com/advanced-search/tag/city/chicago/page:3/

New url: domain.com/advanced-search/tag/city/chicago?page=3

RewriteRule ^advanced-search/tag/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/page:(.*)/$ /advanced-search/tag/$1/$2?page=$3 [R=301,L]

 

I hope you find this useful and please post your contributions!

Share this post


Link to post

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Please refer to our Privacy Policy.