Częściowo działa. Piertwotnie plik. httpd.conf zawierał m.in taki kod (wybrałem tylko te fragmenty, któreg wg. mnie mogą być związane z konfiguracją mod rewrite):
Kod
......................
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/PHP_SERWER/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
..............
<Directory "D:/PHP_SERWER/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
.....................
Przy takim ustawieniu mod rewrite nie działoło. Dokonałem kilka zmian, po których powyższy kod wygląda następująco (4 linijki w których dokonałem zmian oznaczłyem w następujący sposób: # ZMIANA):
Kod
<Directory />
Options FollowSymLinks
AllowOverride All # ZMIANA
#Order deny,allow # ZMIANA
#Deny from all # ZMIANA
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/PHP_SERWER/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All # ZMIANA
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
...............
<Directory "D:/PHP_SERWER/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
plik .htaccess wygląda następująco:
Kod
Options FollowSymLinks
RewriteEngine On
RewriteRule home ?url=home
Jak już zaznaczyłem, mod rewrite działa po tych zmianach tylko częściowo, tzn. linki są już takie jak chcę, tzn. w pliku index.php
Kod
<a href="home">Strona glowna</a>
Plik ster.php
Kod
if (!isset($_REQUEST["url"]))
$url="home";
else
$url=$_REQUEST["url"];
switch ($url)
{
case "home":
include ("home/home.php");
.........................
I kiedy najadę kursorem myszki na link, na pasku statusu przeglądarki widnieje link:
http://192.168.0.1/htdocs/homeKiedy kliknę wczytuje mi się właściwa strona home.php
Czyli wszystko jest w porządku, tylko że po wczytaniu tej strony w polu adresu przeglądarki jest następujący adres:
http://192.168.0.1/htdocs/home/?url=homea powinno być chyba:
http://192.168.0.1/htdocs/homeGdzie leży przyczyna? Może źle skonfigurowałem plik httpd.conf? Czy ktogolwiek go konfiguorował w wersji Apache/2.2.9 (Win32) PHP/5.2.6), pod kątem mod rewrite?