How to Make Site url friendly

  • Thread starter Thread starter 3XPOS3D
  • Start date Start date
  • Views Views 1,664
  • Replies Replies 6

3XPOS3D

New Member
Newbie
Joined
Dec 9, 2015
Messages
4
Reaction score
4
Trophies
0
Age
31
XP
67
Country
notice this for apache based servers.

1.First we need to create a file called
.htaccess in root folder.

2.Let start by enabling mod re-write paste the below code in to the
.htaccess file.

Code:
## Turn On the Rew-Writing Engine
RewriteEngine On

ok great just an fair warning not every host have this enabled so might not work for some.

3.Let say your home page is home.php we going to me it /home/ so the domain will look something like
mysite.com/home/ so let copy the below code to .htaccess

Code:
## Base Dir for home
RewriteRule ^home/$ home.php

great this create the rule for the virtual folder know your code should look like below

Code:
## Turn On the Rew-Writing Engine
RewriteEngine On

## Base Dir for  home
RewriteRule ^home/$home.php

4.Doing great this is the hard part where your calling css & java files or images you will need to do this

Code:
imgs/slider/slider.jpg change to  ../img/slider/slider.jpg

or for css

Code:
css/bootstrap.css change to  ../css/bootstrap.css

5.ok you get the idea how it works so know you can don the second rule for a new page example below.

Code:
## Base Dir for about
RewriteRule ^about/$ about.php

6.As you can see above code is for about page so you get how this works know i hope this is easy enough to follow & have a nice day :P
 
Last edited by 3XPOS3D,
64133285.jpg
 
  • Like
Reactions: Jack_Sparrow
This is to make site URLs look clean.
It looks like this makes it so if you were to go to http://example.com/about then it would pick up about.php but won't redirect you to it.

Note that this code (in the type of format it's using) is for Apache only.
 
Last edited by NodePoint,
Does what RainCode said sorry if my Tutorial are not the best i don't normally type tutorial up so i will do my best to keep them noob friendly
 
  • Like
Reactions: Deleted User

Site & Scene News

Popular threads in this forum