Pogledajte određenu poruku
Staro 06. 12. 2005.   #8
zextra
Boris
Grand Master
 
Avatar zextra
 
Datum učlanjenja: 01.12.2005
Lokacija: Novi Sad
Poruke: 775
Hvala: 5
156 "Hvala" u 2 poruka
zextra is on a distinguished roadzextra is on a distinguished road
Default

najbolje performanse se postizu ako se mod_rewrite pravila upisu direktno u vhost config. uostalom, neke rewrite opcije ni ne mogu da se promene iz per-directory (.htaccess) config fajlova (kao npr RewriteLog).

RewriteMap je dosta mocan alat. Jasno je meni zasto Ilija radi ovako - zgodnije je da imas sve na jednom mestu i da to kontrolises kako tebi odgovara, ali sto kaze ivanhoe, sa mod_rewrite "nema da ne moze!"

kad smo vec kod .htaccess-a, evo sta ja koristim za moj home-made cms.

Kôd:
# .htaccess

# Configure PHP and add source highlighting

AddType application/x-httpd-php-source .phps

php_value display_errors "0"
php_value error_reporting "E_NONE"
php_value magic_quotes_gpc "0"
php_value magic_quotes_runtime "0"
php_value expose_php "0"

# Disable directory indexes

Options -Indexes

# Configure rewrite engine

RewriteEngine On
RewriteOptions MaxRedirects=10

# If http://www.someplace.com/index/ is requested, transform it and stop.
# (otherwise, it will lead to error 500)

RewriteCond %{REQUEST_URI}              /index/
RewriteRule ^.+$                        index.php                [L]

#
# If an existing file is requested, allow direct access
#
# (if a directory contents should be protected, create .htaccess
# file with following contents:
#
# order allow,deny
# deny from all
#
# and save in directory you need.
#

RewriteCond %{SCRIPT_FILENAME}          -f
RewriteRule ^(.+)$                      $1                       [L]

# If user enters http://www.someplace.com/something, check if something.php
# exists in specified directory (/ in this case), and if it does, let user
# access it.

RewriteCond %{SCRIPT_FILENAME}\.php     -f
RewriteRule ^(.+)$                      $1.php                   [L]

#
# Now do some magic: convert url of form
#
# http://www.someplace.com/subdir/mod/act/parm1/val1/
#
# into
#
# http://www.someplace.com/subdir/index.php?subdir/mod/act/parm1/val1/
#
# That allows script to parse all input parameters, and makes it possible to
# move whole directory structure in some subdirectory, without modifications
# in this file. In other hand, script has to figure out which part of param
# string belongs to the path.
#

RewriteCond %{SCRIPT_FILENAME}          !-d
RewriteCond %{REQUEST_URI}              ^/(([^\.]+)?(/((.+)?(/(.+)?)?)?)?)?$
RewriteRule ^.+$                        index.php?%2%3           [L]

# eof .htaccess
da budem iskren, resenje je gotovo identicno onome sto ilija koristi, plus sto sam ja to jos malo zakomplikovao (bez potrebe, ispostavilo se), ali samo zato sto sam imao nesto drugo na umu kada sam pisao ovo.
__________________
"It’s important to have goals when you pet. Otherwise you’re just rubbing another mammal for no reason." - Scott Adams
zextra je offline   Odgovorite uz citat