I've followed some tutorials on how to use Mod_Rewrite
, but it's not working out.
I have a php index page that takes a page parameter like so:
call: index?page=name1, name2, name3 etc.
<?php
if (isset($_GET['page']))
{
switch($_GET['page'])
{
case 'front':
include "front.php";
break;
default:
break;
}
}
?>
I'd like to run mod-rewrite so that the urls display as site.com/name1
. Is this possible with the code i'm using above?
Below is what I've been trying in the apache config files to no avail.
apache/conf/http.conf
line 122: LoadModule rewrite_module modules/mod_rewrite.so
line 188: DocumentRoot "G:/xampp/htdocs"
line 198: #default
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
line 215: <Directory "G:/xampp/htdocs">
line 228: Options Indexes FollowSymLinks Includes ExecCGI
line 235: AllowOverride All
# cgi
line 355:
<Directory "G:/xampp/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
G:\xampp\apache\conf\extra\http.v-hosts.conf
<VirtualHost *:80>
DocumentRoot G:/xampp/htdocs/
ServerName localhost
ServerAdmin admin@localhost
<Directory "G:/xampp/htdocs/localhost/">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot G:/xampp/htdocs/site2/
ServerName site2.localhost
ServerAdmin [email protected]
<Directory "G:/xampp/htdocs/site2.localhost/">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
.htaccess file
IndexIgnore *
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]