views:

60

answers:

1

Hi guys, does anyone has an example how to do a rule in .httpaccess in xampp? I m trying to redirect from localhost/test/company.php?name=Abc to localhost/test/company/Abc and I cant seem to find the solution. I followed some examples that I found on the web but none seems to work. I'm putting the .htacces file in the same folder where I have the company.php file. And I have the urlrewrite turned on. Thanks Greetz

A: 

Put the .htaccess file in your application root.

The .htaccess file should have something like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^company/([a-zA-Z0-9\-]+)$ /company.php?name=$1 [L,NC]

Turn on mod_rewrite and restart apache.

Then it should work.

thephpdeveloper