Laravel/Public 重定向到本地主机
Laravel/Public redirect to localhost
我用这个路径导入了一个项目:C:\wamp64\www\projectName\laravel
我的 .htaccess 重定向到 laravel/public/ 文件夹:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^laravel/public
RewriteRule ^(.*)$ laravel/public/ [L]
没关系,我只是遇到了一些数据库错误,但自从我修复了它后,它给我带来了一些麻烦,因为现在当我在同一个 url 上时,它会重定向我在wamp主页
所以我在路径/projectName/laravel/public 上找到了另一个 .htaccess,但我不知道这是否会干扰另一个 .htaccess,也许吧?
`
选项 - 多视图
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
`
我检查了 rewrite_module on apache 设置
我唯一发现的是 appache 的日志错误:
[Fri Apr 21 11:04:16.781901 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 6444 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:16.822008 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:16.847181 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:16.847682 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:16.847682 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:16.849534 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 5104
[Fri Apr 21 11:04:17.208634 2017] [auth_digest:notice] [pid 5104:tid 452] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:17.232829 2017] [mpm_winnt:notice] [pid 5104:tid 452] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:18.311301 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 5104 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:18.347397 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:18.370859 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:18.370859 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:18.370859 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:18.373581 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 4748
[Fri Apr 21 11:04:18.645510 2017] [auth_digest:notice] [pid 4748:tid 452] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:18.670857 2017] [mpm_winnt:notice] [pid 4748:tid 452] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:19.729942 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 4748 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:19.763030 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:19.783880 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:19.783880 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:19.783880 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:19.785731 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 1008
[Fri Apr 21 11:04:20.041074 2017] [auth_digest:notice] [pid 1008:tid 420] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:20.065001 2017] [mpm_winnt:notice] [pid 1008:tid 420] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:21.135137 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 1008 exited with status 255 -- Restarting.
等....
谁能帮帮我?我有点菜鸟:(
编辑
httpd-vhosts.conf :
<VirtualHost *:80>
ServerAdmin webmaster@hguitare.dev
DocumentRoot "C:\wamp64\www\hguitare\laravel\public"
ServerName hguitare.dev
ServerAlias www.hguitare
ErrorLog "logs/hguitare-error.log"
CustomLog "logs/hguitare-access.log" common
<Directory "C:\wamp64\www\hguitare\laravel\public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
执行此步骤以设置虚拟主机(laravel 项目)
- 转到这个路径C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
- 添加此设置
<VirtualHost *:80>
ServerAdmin webmaster@projectName.dev
DocumentRoot "C:/wamp/www/projectName/public"
ServerName projectName.dev
ServerAlias www.projectName
ErrorLog "logs/projectName-error.log"
CustomLog "logs/projectName-access.log" common
<Directory "C:/wamp/www/projectName/public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory> </VirtualHost>
- 从路径 C:\Windows\System32\drivers\etc\hosts 打开主机文件(作为管理员,否则您不能编辑此文件)
- 添加这一行
127.0.0.1 localhost
127.0.0.1 projectName.dev
- 最后一步重新启动你的 wamp 并检查 (http://projectName.dev/)
我用这个路径导入了一个项目:C:\wamp64\www\projectName\laravel
我的 .htaccess 重定向到 laravel/public/ 文件夹:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^laravel/public
RewriteRule ^(.*)$ laravel/public/ [L]
没关系,我只是遇到了一些数据库错误,但自从我修复了它后,它给我带来了一些麻烦,因为现在当我在同一个 url 上时,它会重定向我在wamp主页
所以我在路径/projectName/laravel/public 上找到了另一个 .htaccess,但我不知道这是否会干扰另一个 .htaccess,也许吧?
` 选项 - 多视图
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
`
我检查了 rewrite_module on apache 设置
我唯一发现的是 appache 的日志错误:
[Fri Apr 21 11:04:16.781901 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 6444 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:16.822008 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:16.847181 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:16.847682 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:16.847682 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:16.849534 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 5104
[Fri Apr 21 11:04:17.208634 2017] [auth_digest:notice] [pid 5104:tid 452] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:17.232829 2017] [mpm_winnt:notice] [pid 5104:tid 452] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:18.311301 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 5104 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:18.347397 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:18.370859 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:18.370859 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:18.370859 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:18.373581 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 4748
[Fri Apr 21 11:04:18.645510 2017] [auth_digest:notice] [pid 4748:tid 452] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:18.670857 2017] [mpm_winnt:notice] [pid 4748:tid 452] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:19.729942 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 4748 exited with status 255 -- Restarting.
[Fri Apr 21 11:04:19.763030 2017] [auth_digest:notice] [pid 5284:tid 572] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:19.783880 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00455: Apache/2.4.23 (Win64) PHP/5.6.25 configured -- resuming normal operations
[Fri Apr 21 11:04:19.783880 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Fri Apr 21 11:04:19.783880 2017] [core:notice] [pid 5284:tid 572] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Fri Apr 21 11:04:19.785731 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00418: Parent: Created child process 1008
[Fri Apr 21 11:04:20.041074 2017] [auth_digest:notice] [pid 1008:tid 420] AH01757: generating secret for digest authentication ...
[Fri Apr 21 11:04:20.065001 2017] [mpm_winnt:notice] [pid 1008:tid 420] AH00354: Child: Starting 64 worker threads.
[Fri Apr 21 11:04:21.135137 2017] [mpm_winnt:notice] [pid 5284:tid 572] AH00428: Parent: child process 1008 exited with status 255 -- Restarting.
等....
谁能帮帮我?我有点菜鸟:(
编辑 httpd-vhosts.conf :
<VirtualHost *:80>
ServerAdmin webmaster@hguitare.dev
DocumentRoot "C:\wamp64\www\hguitare\laravel\public"
ServerName hguitare.dev
ServerAlias www.hguitare
ErrorLog "logs/hguitare-error.log"
CustomLog "logs/hguitare-access.log" common
<Directory "C:\wamp64\www\hguitare\laravel\public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
执行此步骤以设置虚拟主机(laravel 项目)
- 转到这个路径C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
- 添加此设置
<VirtualHost *:80> ServerAdmin webmaster@projectName.dev DocumentRoot "C:/wamp/www/projectName/public" ServerName projectName.dev ServerAlias www.projectName ErrorLog "logs/projectName-error.log" CustomLog "logs/projectName-access.log" common <Directory "C:/wamp/www/projectName/public"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1 </Directory> </VirtualHost>
- 从路径 C:\Windows\System32\drivers\etc\hosts 打开主机文件(作为管理员,否则您不能编辑此文件)
- 添加这一行
127.0.0.1 localhost 127.0.0.1 projectName.dev
- 最后一步重新启动你的 wamp 并检查 (http://projectName.dev/)