简体   繁体   中英

How do I get mod_rewrite to work with EasyPHP?

My mod_rewrite fails to work. This is the mod_rewrite section:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
  RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>

It works like a charm on Ubuntu and OS X, but fails on EasyPHP under Windows. I have uncommented the following line in the apache configuration:

LoadModule rewrite_module modules/mod_rewrite.so

And I have set every single AllowOverride directive to All (it's just a local server so it's irrelevant as far as security goes). The vhost entry for the particular vhost I would like mod_rewrite to be on is as follows:

<VirtualHost 127.0.0.1>
    DocumentRoot "E:/Dropbox/Websites/mysite/public"
    ServerName myvhost.mysite
    <Directory "E:/Dropbox/Websites/mysite/public">
        Options FollowSymLinks Indexes
        RewriteEngine On        
        AllowOverride All
        Order allow,deny
        Allow from all
        #Deny from all
        Require all granted
    </Directory>
</VirtualHost>

If I put a "die" at the top of the index.php file in my public folder, it never happens, so apparently the mod rewrite never even tried to redirect it to index.php. All I get are 404s.

See this answer:

easyphp and .htaccess

Default installation of Apache in EasyPHP don't have activated the option to use .htaccess files to modify server configuration in folders.

You have to tell Apache what configuration can be changed with .htaccess files, and in which folder. To enable all config changes on main web server, you should edit http.conf (in Apache/conf folder), and look for

Hope this helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM