Jump to content

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)

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.