Starting with .htaccess

1

Hello; I am trying to create friendly URLs for a website, but I am not succeeding in several examples that I have tested on the internet. I think my problem is how I redirect the structure of my site, I own the page empresa.php that is inside other subfolders, having this path: website/pageswebsite/empresa.php . I'm trying to get the url to be thrown only by: 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 many ways, but I was not successful, I ask the forum for help because I did not know much about .htaccess , now that I'm starting to work with it;

    
asked by anonymous 10.11.2016 / 20:03

1 answer

1

Checks if apache 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 this file and make sure that mod_rewrite is enabled. If you do not have it you can run the command:

a2enmode rewrite

and then restart apache:

service apache2 restart
    
10.11.2016 / 20:07