Jump to content

help with preg_replace


irkevin

Recommended Posts

Hi everyone,

 

I need some help to understand how preg_replace work.. Right now, i have a link which is dynamic, like so

 

http://www.mu-anime.com/index.php?page=CompletedSeries&id=1

 

I want to use preg_replace to convert it like so

 

http://www.mu-anime.com/completed/1.html

 

I used .htaccess, but now i have to convert the link on my website also and have no idea how to start .. Any help plz?

Link to comment
https://forums.phpfreaks.com/topic/149994-help-with-preg_replace/
Share on other sites

Well, what do  you recommend to use for doing this?

 

I'm trying to make my links more friendly for google.. SEF i supose.

 

I've been able to use htaccess to convert the links from dynamic to static.. but now, i have to convert them on my website also so that people can access the static one. .

 

Do you get it now?

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^(.*)/(.*).html$ /index.php?page=$1&id=$2 [NC]


 

That will re-write:-

http://www.mu-anime.com/index.php?page=CompletedSeries&id=1

to

http://www.mu-anime.com/CompletedSeries/1.html

 

[NC] = No Case (Case Insensitive)

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.