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
https://forums.phpfreaks.com/topic/70407-need-help-with-url-rewrite/
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

Archived

This topic is now archived and is closed to further replies.

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