简体   繁体   English

PhP本地主机重定向到/var/www/html/index.php

[英]PhP local host redirecting to /var/www/html/index.php

I am using Ubuntu machine. 我正在使用Ubuntu计算机。 I am running lampp server for php files. 我正在运行Lampp服务器以获取php文件。

I have all my PHP files in my_folder where I have all my codes in /opt/lampp/htdocs/my_folder including index file in /opt/lampp/htdocs/my_folder/index.php . 我所有的PHP文件都在my_folder ,我的所有代码都在/opt/lampp/htdocs/my_folder包括索引文件在/opt/lampp/htdocs/my_folder/index.php

I wanted to check my codes by running http://localhost/index.php in Chrome browser, but for some reason it keeps directing me to /var/www/html/html.index file. 我想通过在Chrome浏览器中运行http://localhost/index.php来检查代码,但是由于某些原因,它一直将我定向到/var/www/html/html.index文件。 Can someone please help me resolve this problem? 有人可以帮我解决这个问题吗?

Thanks in advance. 提前致谢。

add this to you apache config. 将此添加到您的apache配置。

DocumentRoot /opt/lampp/htdocs/my_folder
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /opt/lampp/htdocs/my_folder>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

Adittionally, If MySQL doesn't start: 另外,如果MySQL无法启动:

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop
sudo /etc/init.d/proftpd stop
sudo /opt/lampp/lampp start

暂无
暂无

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

相关问题 致命错误:在/var/www/html/index.php中找不到类“ Aws \\ SDK” - Fatal error: Class 'Aws\Sdk' not found in /var/www/html/index.php 在默认 var/www/html 文件夹内的实时服务器中,如果没有 index.php,codeigniter 路由将无法工作 - codeigniter routes not working without index.php in live server inside default var/www/html folder 无法从AWS Lite上的服务器/ var / www / html加载index.php codeigniter文件 - index.php codeigniter file doesn't load from server /var/www/html on aws lite 在/var/www/index.php中找不到类“ Solarium \\ Client” - Class 'Solarium\Client' not found in /var/www/index.php AH01276:无法提供目录/ var / www / html /:找不到匹配的DirectoryIndex(index.php,index.html) - AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found RewriteRule重定向到index.php - RewriteRule redirecting to index.php .htaccess没有重定向到/index.php - .htaccess not redirecting / to /index.php 重定向到index.php但未在搜索栏中显示“index.php” - Redirecting to index.php but not showing 'index.php' in search bar 非www到www。 重定向并将index.html重定向到index.php - non-www to www. redirect AND redirect index.html to index.php PHP致命错误:不能对表达式的结果使用isset()(您可以在第14行的/var/www/html/index.php中使用“null!== expression”) - PHP Fatal error: Cannot use isset() on the result of an expression (you can use “null !== expression” instead) in /var/www/html/index.php on line 14
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM