We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

Abe on 01/14/08


Tagged

url php htaccess nice


Versions (?)


Who likes this?

49 people have marked this snippet as a favorite

section31
inetguy
damarev
llbbl
kdaviesnz
jonhenshaw
vilebender
luman
kiliksun
Cory
falp
bioascii
vincent
huze
jeff
Steffen82
tpms
Abe
leachypeachy
DFCNT
Morgano
hochitom
avioli
stphnclysmth
SpinZ
dyesin
Zidizei
zeljkoprsa
Akiva
ibomb
dryliketoast
Nix
romanos
willbolton
pixelhandler
chph
coylOne
ezerick
grn
jdstraughan
Dingdong
taboularasa
tikitakfire
Kerrick
nickdoherty
stavelin
atma
oriolfb
lzyy


Nice URLS PHP .htaccess


Published in: PHP 


URL: http://spindrop.us/2006/07/26/how-to-remove-file-extensions-from-urls/

You can combine them with this: http://snipplr.com/view/4848/underscore-strings/

  1. .htaccess
  2. RewriteEngine On
  3. RewriteCond %{REQUEST_FILENAME} !-f
  4. RewriteCond %{REQUEST_FILENAME} !-d
  5. RewriteRule ^(.*)$ $1.php [L,QSA]
  6. # http://domain/about -> http://domain/about.php
  7.  
  8. --------------------------------------------------
  9.  
  10. .htaccess
  11. RewriteEngine On
  12. RewriteCond %{REQUEST_FILENAME} !-f
  13. RewriteCond %{REQUEST_FILENAME} !-d
  14. RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  15. # http://domain/about -> http://domain/index.php?q=about
  16.  
  17. <?php
  18. // $url_data is an array
  19. $url_data = explode("/",$HTTP_SERVER_VARS['PATH_INFO']);
  20. ?>

Report this snippet 

You need to login to post a comment.