Solved

Working with .htaccess files - Display Friendly URL

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
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…

695 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