Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Working with .htaccess files - Display Friendly URL

Posted on 2008-06-12
4
Medium Priority
?
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
Blaz earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. 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 : Open Page or Post…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
Suggested Courses
Course of the Month9 days, 10 hours left to enroll

610 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