I have an htaccess file with a simple rewrite rule.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/?$ index.php?page=$1
On my web server, the index.php file is in /var/www, and it works normally.
On my local host, the index.php fle is in /var/www/projects/porto and while the file runs normally, no linked content ( images, css, etc ) is loaded.
I am totally new to htaccess files. Any ideas on how to work around it so I can do my testing in my locan environment?
All I’ve tried is changing my .htaccess file to
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/?$ /running/Porto/index.php?page=$1
But no luck.
Okay, so continuing our discussion on setting up a VirtualHost on your local machine/environment, it is roughly the same as on your other server. If you can copy the Apache configuration file from the web server then that will be a good start. At a minimum you will need something like this:
(This assumes that somewhere in the file you have
NameVirtualHost *:80)The one additional thing you will need to do in your local environment is add a hosts entry:
In Linux you usually do this in /etc/hosts with something like: