
December 13th, 2011, 04:45 AM
|
|
Contributing User
|
|
Join Date: Dec 2011
Posts: 37
Time spent in forums: 8 h 33 m
Reputation Power: 2
|
|
|
mod_rewrite - Redirect everything to single php file
Hello everyone,
I am running Vista, Apache 2.2 and PHP 5.38 on my development machine. I want to build a site where each request is redirected to index.php, and that will take care of the processing..
I have mod_rewrite module loaded in Apache.
.htaccess:
PHP Code:
Options +FollowSymlinks RewriteEngine on RewriteRule ^([^/]+)/ index.php
index.php:
PHP Code:
<?php $address=$_SERVER['PHP_SELF']; $output=""; $output+="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"link\"><html xmlns=\"link\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>123</title></head><body>"; $output+=$address; $output+="</body></html>"; print($output); ?>
When I try to open localhost/test, I get a 404 page
How can I achieve this?
Cheers
|