http://localhost/newsite/?page=index.html
http://localhost/newsite/?page=page1&var1=val1
http://localhost/newsite/?page=page2&va ... &var2=val2
i want to make it look as
http://localhost/newsite/index (without extension)
http://localhost/newsite/page1(without extension)
sorry. i know that i should edit .htaccess.
and do something with mod_rewrite.
but i didnt read about it.
mod_rewrite.
Moderator: General Moderators
Choose the Right Board
Basically you'll just need a few rewrite rules in your .htaccess file
Moved to installation and configuration.
Code: Select all
RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
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']
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
this is the error i am gettingscottayy wrote: RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1
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
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.
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
Code: Select all
$_SERVER['PHP_SELF']Some tutorials first, second, third.
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
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
[/quote]RewriteEngine On
RewriteRule ^newsite/(.+)$ index.php?page=$1