Solved

Working with .htaccess files - Display Friendly URL

Posted on 2008-06-12
4
197 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Wondering how you can get your new website ranking on Google Search so that people find you online?  The answer is Search Engine Optimization (SEO). So how do you Start Ranking a New site with SEO?  Below is a starter guide to get your new website S…
With more and more people tethered to the internet, advertisers can reach you in new and creative ways. Push notifications on your smartphone, customized advertisements based on your previous searches, and email inboxes filled with promotional pitch…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

895 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

16 Experts available now in Live!

Get 1:1 Help Now