How to Make Site url friendly

3XPOS3D

New Member
OP
Newbie
Joined
Dec 9, 2015
Messages
4
Trophies
0
Age
29
XP
47
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,
D

Deleted User

Guest
64133285.jpg
 
  • Like
Reactions: Jack_Sparrow

NodePoint

  
Member
Joined
Sep 29, 2015
Messages
164
Trophies
0
Location
that was a lie -- actually somewhere in europe
XP
178
Country
United States
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,

3XPOS3D

New Member
OP
Newbie
Joined
Dec 9, 2015
Messages
4
Trophies
0
Age
29
XP
47
Country
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

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: but im too stupid to know