Solved

Working with .htaccess files - Display Friendly URL

Posted on 2008-06-12
4
195 Views
Last Modified: 2010-03-04
Hello,

I'm currently using WordPress as my blogging software. I've recently installed a plugin (http://me.mywebsight.ws/web/wppa) that allows me to manage multiple image galleries. By default, all galleries are displayed as so:

http://www.mysite.com/galleries/?album=89&photo=3693

I would instead like to display the URL using the actual album and photo name:

table_photos
ID         photo                 album
3693     blue_sky           san_diego

http://www.mysite.com/galleries/san_diego/blue_sky

I'm just wondering how hard it would be to modify the Plugin and .htaccess file to display the URL in this manner.

Thanks!

0
Comment
Question by:wattanabi2
4 Comments
 
LVL 16

Accepted Solution

by:
Blaz earned 500 total points
ID: 21776408
I don't know about the plugin and the possibilities to change it but I can suggest an Apache only configuration change that can accomplish a similar result.

The idea is that you still keep the two ID's in the URL but also add the textual description, like:
http://www.mysite.com/galleries/89/3693/san_diego/blue_sky

or similar.

The idea is to write a rewrite rule that will convert
/galleries/<galleryID>/<photoID>/*ANYTHING*
to:
/galleries/?album=<galleryID>&photo=<photoID>


Start with the rule:
RewriteRule ^/galleries/([0-9]+)/([0-9]+)/.* /galleries/?album=$1&photo=$2

http://www.sitepoint.com/article/guide-url-rewriting

Changing to the link you posted would require changing of the plugin so that it would search by strings instead of IDs. Then you get the problems with possible duplicates - two records with the same string etc.
0
 
LVL 15

Expert Comment

by:dosth
ID: 21830653
did you get it working?
0
 

Author Comment

by:wattanabi2
ID: 21831121
Not yet. I'm currently modifying the plugin to accept strings instead of ID's.

thanks
0
 
LVL 3

Expert Comment

by:Bivek-jos
ID: 21880803
Hi wattanabi2,

I thought you want to enable Permalink in wordpress,

Sign to wordpress admin=> Click Option tab=> Click PermaLink  => and enable permalink from there

If you have any problems in wordpress contact me.or reply here

Thank You.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now