Page 1 of 1
mod_rewrite.
Posted: Fri Dec 21, 2007 1:15 am
by claws
Choose the Right Board
Posted: Fri Dec 21, 2007 1:21 am
by s.dot
Basically you'll just need a few rewrite rules in your .htaccess file
Code: Select all
RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1
Moved to installation and configuration.
Posted: Fri Dec 21, 2007 1:22 am
by claws
and i hope from security point of view
is this safe. or can it be exploited in anyway. i dont know much about security related issues.
Posted: Fri Dec 21, 2007 1:25 am
by s.dot
As long as you verify the page=index.html part. Check that index.html is indeed a file, and one that you wish to serve. it might help to strip .. (two periods) from the $_GET['page']
Posted: Fri Dec 21, 2007 1:27 am
by claws
scottayy wrote:
RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1
this is the error i am getting
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
Posted: Fri Dec 21, 2007 1:30 am
by Rovas
First check that the Apache server has the file mod_rewrite.dll (on Win systems) which does the url rewriting.
Second edit the htaccess file starting the rewrite module, put the rules using regular expressions and that' s that for the Apache.
For php to recognize the parameters passed use a global variable
to get the parameters then you use them.
Some tutorials
first,
second,
third.
Posted: Sat Dec 22, 2007 12:38 am
by claws
thanks.
mod_rewrite.so is present in modules directory.
and in httpd.conf
#LoadModule mod_rewrite.conf
was commented intially. i have uncommented in and restarted the server.
now its not showing the 500 error.
but showing
404 error
http://localhost/newsite/page1 --- accessed url(it simply showing 404 error)
is my .htaccess file in both root directory aswell as in 'newsite' directory
RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1
[/quote]