Sorry I changed the previous question. I have problem with .htaccess rewrite rule on localhost, I have .htaccess file in http:// localhost/testing/.htaccess. I want to change url like below
http://localhost/testing/site.php?site=test
to
http://localhost/testing/test
And I have code in .htaccess as
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ site.php?site=$1 [L]
Which is working correct, but I have also url like
http://localhost/testing/pages.php?site=test&pid=2
Here pages.php with two parameters as site name and page id. I want rewrite this as
http://localhost/testing/test/2
For both conditions I have bellow code which is not working
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ site.php?site=$1 [L]
RewriteRule ^([^/\.]+)/?$ pages.php?site=$1&pid=$2 [L]
Please Help
Thanks :)
I got solution which worked for me.
Thanks everyone :)
You need to do is turn on the mod_rewrite on your apecha server by preforming these steps:
Assuming you have unpacked the xampp folder in the
C:\
directory, navigate to the folder containing the apache configuration files. The full path isC:\xampp\apache\conf\.
In the conf folder, you will find a file named httpd.conf. This file holds all the configuration parameters for apache. Open the file in a text editor.
Search for mod_rewrite.so and you will come across a line as follows :
#LoadModule rewrite_module modules/mod_rewrite.so
Uncomment the line by removing the hash (#) mark.
Save the file and restart Apache web server.
and also if the file is already in the
testing
folder your code should look like this: