Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

Very easy and simple .htaccess & PHP tutorial

Posted on May 11, 2018August 4, 2020 by Habibie

If you work with PHP, you notice that this URL: http://yoursite.com/index.php?post=2 is not pretty at all. There is term “Pretty URL” and a lot of tutorials how to make your URL prettier. In this post I’m going to share a few line of .htaccess codes to make your URL more prettier.

Let’s go back to that URL. Here is the goal, we want to make a fake URL like this: http://yoursite.com/post/2/ that redirects us behind the scene to that ugly URL (http://yoursite.com/index.php?post=2).

Here is what we need to add to our .htaccess file:

RewriteEngine On
RewriteRule ^post/(.*)$ index.php?post=$1

Read this post to know how to create an .htaccess file: http://zofiakreasi.com/htaccess-tutorial-removing-php-extension/

$1 in that code is a variable. So if a user opens this URL: http://yoursite.com/post/110/ then the value of $1 is number 110.

Post Views: 387
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme