Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[TUTORIAL][web developer] How to remove .php in URL

Vin Karl Love

Novice
Advanced Member
Messages
20
Reaction score
0
Points
26
My First Thread
Baka mayroon lang hong interesado. bagong style ng links now a days.
requirements:
  • xampp
  • notepad++
  • browser

step 1: open notepad++ then type the ff:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
step 2: save file as filename = ".htaccess"(with double quote.) in your project folder.
example: "C:\xampp\htdocs\project\.htaccess"​
NOTE: File name should be exactly .htaccess without file extension .txt or it will not going to work.
by jskhulitz

step 3: Pwede kanang mag simula ng project mo. pag ilink mo ung pages sa loob ng PHP file.kahit wla nang extention file pag mag href ka.or any.. For example:
Code:
<a href="project/home" title="homepage">home</a>

for more info about .htaccess:
.htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software.​

eto po.result example::lol:
View attachment 308405
 

Attachments

  • Untitled.png
    Untitled.png
    39.5 KB · Views: 119
Last edited:
step 2: save file as filename = ".htaccess"(walang double quote.) in your project folder.

Hi, paki-rewrite lang itong part na ito...

Kapag nag-save ka gamit ang isang text editor, ang default file type / extension nya ay .txt, kapag nilagay mo ang filename as .htaccess lang (without the quotation marks), possible na idetect lang yan ng text editor as a naming convention at mag append pa din sya ng .txt sa dulo.

By using ".htaccess" (with the quotation marks), you are forcing the text editor, na iyon na mismo ang gawin filename nung file na sine-save mo.

While, for some text editors, gagana yung nauna mo instruction. For some, baka hindi. So dun tayo sa sigurado. :D

PS: Nice post for your first thread.
 
Hi, paki-rewrite lang itong part na ito...

Kapag nag-save ka gamit ang isang text editor, ang default file type / extension nya ay .txt, kapag nilagay mo ang filename as .htaccess lang (without the quotation marks), possible na idetect lang yan ng text editor as a naming convention at mag append pa din sya ng .txt sa dulo.

By using ".htaccess" (with the quotation marks), you are forcing the text editor, na iyon na mismo ang gawin filename nung file na sine-save mo.

While, for some text editors, gagana yung nauna mo instruction. For some, baka hindi. So dun tayo sa sigurado. :D

PS: Nice post for your first thread.

thanks master. pag bubutihin ko po sa susunod.hehehe:praise:
 
ts patambay po dito, baka my idea ka kung paano tanggalin ang "?"
thanks
 
ts patambay po dito, baka my idea ka kung paano tanggalin ang "?"
thanks

yes.idag dag mo lang to sa htaccess:
Code:
<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^profile/([^.]*)$ home.php?a=$1&b=$1 [QSA,L]
</IfModule>
kung mapapansin mo. may home.php sya. so baguhin mo lang ung "home.php" kung saan ung gustong tanggalan ng question mark(?), sya din ang filename na ilagan mo.
 
Last edited:
try nyo gumamit ng php frameworks kaya na din matangal yung .php. like codeigniter suggest lang :D
 
try nyo gumamit ng php frameworks kaya na din matangal yung .php. like codeigniter suggest lang :D

tnx sa suggestion sir. pang expert na kc ang level ng framework. kung link lang naman momodify. ok naman siguro ung htaccess.hehe
 
try nyo gumamit ng php frameworks kaya na din matangal yung .php. like codeigniter suggest lang :D

Yes, tama ito... Pero siyempre, kailangan mo nalaman kung paano nangyari na "natanggal ung .php" di ba? mahirap naman ung gagamit lang tayo ng isang tool, tapos wala tayo idea sa mga nangyari.
 
Yes, tama ito... Pero siyempre, kailangan mo nalaman kung paano nangyari na "natanggal ung .php" di ba? mahirap naman ung gagamit lang tayo ng isang tool, tapos wala tayo idea sa mga nangyari.

yes.magkaibang magkaiba kc ung codeigniter sa htaccess sir. controller kc ang ginagamit sa codeigniter. so kumbaga variable na ang tinatawag mo. hindi ung .php...but i admit.mag maganda ung codeigniter.ayun nga lang. maraming plugins.download mo lang.
 
yes.magkaibang magkaiba kc ung codeigniter sa htaccess sir. controller kc ang ginagamit sa codeigniter. so kumbaga variable na ang tinatawag mo. hindi ung .php...but i admit.mag maganda ung codeigniter.ayun nga lang. maraming plugins.download mo lang.

Parehong htaccess lang din gamit ni TS at ng CI. Magkaiba lang pattern at interpretation. Both kailangan na apache na naka-enable yung rewrite module. Pero kung ibang web server ang gamit (like nginx), iba ang paraan (dun mismo sa server/vhost config).
 
yes, tama ito... Pero siyempre, kailangan mo nalaman kung paano nangyari na "natanggal ung .php" di ba? Mahirap naman ung gagamit lang tayo ng isang tool, tapos wala tayo idea sa mga nangyari.

yeah right :)
 
Parehong htaccess lang din gamit ni TS at ng CI. Magkaiba lang pattern at interpretation. Both kailangan na apache na naka-enable yung rewrite module. Pero kung ibang web server ang gamit (like nginx), iba ang paraan (dun mismo sa server/vhost config).

ay:slap:.parehas lang pla sila gumagamit ng htaccess.haha. senya. pero ung function kc sa codeigniter kc.hehe.. akala ko un na yung ibig nyang sabihin.
 
yes.idag dag mo lang to sa htaccess:
Code:
<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^profile/([^.]*)$ home.php?a=$1&b=$1 [QSA,L]
</IfModule>
kung mapapansin mo. may home.php sya. so baguhin mo lang ung "home.php" kung saan ung gustong tanggalan ng question mark(?), sya din ang filename na ilagan mo.

salamat po sa pag reply ts sir. try ko later, feedback kita.
may ask din ako sir, kailangan ba talaga gumamit ng php framework para maging webdev sir?
meron pa ba pag-asa ako maging webdeb kahit php oop at pdo ang gamit ko?
salamat sa sagot.
 
salamat po sa pag reply ts sir. try ko later, feedback kita.
may ask din ako sir, kailangan ba talaga gumamit ng php framework para maging webdev sir?
meron pa ba pag-asa ako maging webdeb kahit php oop at pdo ang gamit ko?
salamat sa sagot.

nag sisimula palang din ako sir. dito ako kumakalap ng kaalaman
By spyx3m_119
 
not working sa vertrigoserv tagal ko na tong problema boss
 
URL Rewrite, masakit sa ulo!!!!:slap:

medyo madali pa yang pagtanggal ng extension, eto hanggang ngayon wala pa akong solusyon.

http://localhost/mypage/index.php?id=1&order=5&type=102

gusto ko maging ganito:

http://localhost/mypage/id/1/order/5/type/102

eto yung starting .htaccess code ko:

Code:
<IfModule mod_rewrite.c>
    
    RewriteEngine On
    RewriteBase /mis
    

    RewriteRule ^/?([0-9]+)$ index.php?id=$1 [L]
    
    RewriteRule ^/?([0-9]+)/([0-9]+)$ index.php?id=$1&order=$2 [L]
      
</IfModule>

AYAW MAGWORK PAG 2 NA YUNG PARAMETERS. baka merong nakakaalam kung paano, thanks!
 
Back
Top Bottom