Starting with . htaccess

Asked

Viewed 61 times

2

Hello; I’m trying to create friendly Urls for a site, but I’m not succeeding in several examples I’ve tried online. I think my problem is in the way I should redirect the structure of my site, I own the page company.php that is within other subfolders, having this path: website/pageswebsite/empresa.php. I am trying that the URL can be triggered only through: www.site.com/empresa as follows:

<IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteRule ^empresa/?$ website/pageswebsite/empresa.php [NC,L]

</IfModule>

I have tried in various ways, but I have not succeeded, I ask for help from the forum even because I did not know much about .htaccess, now that I’m starting to work with the same;

1 answer

1


Check if apache’s mod_rewrite is enabled. To do this, create an info.php file at the root of the application and put it in it:

<?php phpinfo(); ?>

then go to the browser and call the url for that file in it check that mod_rewrite is enabled. If you do not have you can execute the command:

a2enmode rewrite

and then re-start apache:

service apache2 restart

Browser other questions tagged

You are not signed in. Login or sign up in order to post.