You are here
Home > Php > Url Rewriting like WordPress

Url Rewriting like WordPress

Hello Friends, Today I am going to share a code for Url rewriting like WordPress do. I have taken help to develop this code from WordPress codex link mentioned below:-

https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/class-wp-post-type.php#L532
https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/class-wp-matchesmapregex.php

Actually, these days I am developing CMS in which I was required to do Url rewriting code. So to do Url Rewriting like WordPress I have googled and researched on WordPress codex. Now Here is the final code..

config.php

matches.php

index.php

.htaccess

Note: Here RewriteBase and RewriteRule starts with “/urlrewrting/“, because the all code is in urlrewriting directory but you can change it to “/“, if you put your code in www directory in case of LAMP, WAMP or MAMP htdocs in case of XAMPP or public_html in case of hosted on server.

Output

Home Page

Login Page

Register Page

Logout Page

Category Page

Category Page

Category Page

Tag Page

Tag Page

Search Page

Author Page

Page or Post Page

Posts Page

Download

 

Thanks for Visiting

Please do share if you like it

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.
https://www.zatackcoder.com

Comments

zatackcoder
Top