Using Mod-Rewrite in XAMPP
I followed some tutorials on how to use Mod_Rewrite
but it doesn't work.
I have a php index page that accepts a page parameter like this:
call: index?page=name1, name2, name3 etc.
<?php
if (isset($_GET['page']))
{
switch($_GET['page'])
{
case 'front':
include "front.php";
break;
default:
break;
}
}
? >
I want to run mod-rewrite so that urls appear as site.com/name1
. Is this possible with the code I am using above?
Below is what I've tried in 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 admin@site2.localhost
<Directory "G:/xampp/htdocs/site2.localhost/">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
.htaccess
IndexIgnore *
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]
+2
a source to share