Jump to content

Need help with URL rewrite


zeta1600

Recommended Posts

I am not a php programmer. But, I have done some tweaking with existing scripts to customize it... a little bit. I am working on a site using a script called Phormer. This is a php * gallery without the need for a mysql database. Of course it doesn't come with documentation. My customer is not yet willing to move to a new hosting company. It would be so much easier for me if it did so I can use an easier script.

 

Anyway, I was wondering if any of you could help me. He wants the urls to end up with a seo friendly. Is this possible? I think it is. I have read a couple of things and tested and tweaked some Rewrite rules, but I can't seem to get it to work. Here is a couple url samples:

 

http://www.mysite.com/plants/?p=114

http://www.mysite.com/plants/?p=50

We'd like to use words instead of the numbers. So, pulling from a * name... hope to hear from you soon.

 

thanks in advance.

Link to comment
Share on other sites

Yes, sure you can do it.

 

Let's say you want to rewrite your url from

http://www.mysite.com/plants/?p=50

to

http://www.mysite.com/plants/sunflower/

 

Options +Indexes
Options +FollowSymlinks
RewriteEngine on

RewriteRule ^plants/([a-zA-Z-_]+)/$ plants.php?p=$1

 

For this occasion you will need to tweak your php script to search for the names, a little troublesome, but there's still other easier way but it includes the number.

 

Example:

http://www.mysite.com/plants/?p=50

to

http://www.mysite.com/plants/sunflower-50/

 

Options +Indexes
Options +FollowSymlinks
RewriteEngine on

RewriteRule ^plants/([a-zA-Z-_]+)-([0-9]+)/$ plants.php?p=$2

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.