简体   繁体   English

使用.htaccess和localhost url路由的问题

[英]Problems with routing using.htaccess and localhost url

I am trying to route traffic from my delopment url to my MCV controller using mod_rewrite for Apache. 我正在尝试使用mod_rewrite for Apache将流量从我的开发URL路由到我的MCV控制器。 But i keep getting a "Internal Server Error" . 但是我一直收到“内部服务器错误”

Spects: Windows 10, WAMP 斑点: Windows 10,WAMP

Localhost url : taskmanager.local Localhost网址 :taskmanager.local

.htaccess file: .htaccess文件:

<IfModule mod_rewrite.c>
    Options -Multiviews
    RewriteEngine On
    RewriteBase taskcomplete.local/public
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

Virtual Host: 虚拟主机:

# TaskComplete
<VirtualHost *:80>
  DocumentRoot "D:\Dropbox\web\projects\php\task_complete"
  ServerName taskcomplete.local
  <Directory "D:\Dropbox\web\projects\php\task_complete">
    Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Ok, so after some random fumbling i solved the issue. 好吧,所以经过一些随机摸索后,我解决了这个问题。 I made some changes to my .htaccess file and httpd-vhost.conf file and everything and now the localhost url points to the /public folder as it should. 我对.htaccess文件和httpd-vhost.conf文件以及所有内容进行了一些更改,现在localhost URL会httpd-vhost.conf指向/public文件夹。

.htaccess file: .htaccess文件:

<IfModule mod_rewrite.c>
    Options -Multiviews
    RewriteEngine On
    RewriteBase /public                          
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

CHANGES taskcomplete.local/public => /public 变化 taskcomplete.local/public => /public

Virtual Host: 虚拟主机:

# TaskComplete
<VirtualHost *:80>
  DocumentRoot "D:\Dropbox\web\projects\php\task_complete"
  ServerName taskcomplete.local
  <Directory "D:\Dropbox\web\projects\php\task_complete">
    Options Indexes FollowSymLinks ExecCGI Includes
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

CHANGES D:\\Dropbox\\web\\projects\\php\\task_complete => D:\\Dropbox\\web\\projects\\php\\task_complete\\public 更改 D:\\Dropbox\\web\\projects\\php\\task_complete => D:\\Dropbox\\web\\projects\\php\\task_complete\\public

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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