简体   繁体   English

当我在地址栏中按回车键时,Laravel 6 重定向到 https://www.example.com/index.php,地址为 www.example.com/profile?

[英]Laravel 6 redirecting to https://www.example.com/index.php when I press enter in the address bar with an address of www.example.com/profile?

I would think others are having the same issue.我认为其他人也有同样的问题。 I am on a shared server with Inmotion Hosting creating basic profile pages.我在使用 Inmotion Hosting 创建基本配置文件页面的共享服务器上。 When I put my cursor up in the address bar for example the url ' https://www.example.com/profile ' and press enter Laravel brings up http://www.example.com/index.php which is a blank page.当我将光标放在地址栏中时,例如 url ' https://www.example.com/profile ' 并按 Enter Laravel 会显示http://www.example.com/index.php这是一个空白页。 This only happens in Chrome.这只发生在 Chrome 中。 I am guessing it may have to do with my .htaccess file?我猜这可能与我的 .htaccess 文件有关? Below is that file.下面是那个文件。 Any ideas?有任何想法吗?

<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^pollaclicks.com [NC] 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

This link https://www.example.com/profile (considering it to be example) does not exists and hence it is redirected to http://www.example.com/index.php with reference to your example links and rules written in your .htaccess file.此链接https://www.example.com/profile (将其视为示例)不存在,因此参考您的示例链接和规则将其重定向到http://www.example.com/index.php写在你的 .htaccess 文件中。

In .htaccess file these rules are creating the issue :在 .htaccess 文件中,这些规则造成了问题:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

It means that if the file with the specified name doesn't exist, or the directory doesn't exist then proceed to the rewrite rule below.这意味着如果指定名称的文件不存在,或者目录不存在,则继续下面的重写规则。

The [L] flag causes mod_rewrite to stop processing the rule set [L]标志导致 mod_rewrite 停止处理规则集

暂无
暂无

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

相关问题 为什么www.example.com/index.php/my/path/here由index.php处理? - Why www.example.com/index.php/my/path/here is processed by index.php? Ubuntu-如何直接将example.com/opencart/index.php定向到http://example.com/和www.example.com? - Ubuntu - How direct example.com/opencart/index.php to http://example.com/ and www.example.com? 在htacess中从https://example.com重定向到https://www.example.com - Redirecting from https://example.com to https://www.example.com in htacess 使用htaccess将http://www.example.com/重定向到https://www.example.com/ - redirect http://www.example.com/ to https://www.example.com/ with htaccess 通过www.example.com/page而不是www.example.com/page.php访问URL - Accessing URLS by www.example.com/page instead of www.example.com/page.php 如何将网址从www.example.com/index.php?store=test重写为.htacess中的test.example.com或www.test.example.com - How to rewrite the url from www.example.com/index.php?store=test to test.example.com or www.test.example.com in .htacess 如何将我的URL像www.example.com/profile.php?id=xyz转换为www.example.com/xyz? - How do i convert my URL's like www.example.com/profile.php?id=xyz into www.example.com/xyz? 我可以从http://www.example.com/example.php下载.php文件吗 - Can I download .php file from http://www.example.com/example.php URL重写从www.example.com/blog/blog.php到www.example.com/blog/ - URL rewriting going from www.example.com/blog/blog.php to just www.example.com/blog/ 为什么“www.example.com”与“example.com”不一样? - Why is “www.example.com” not the same as “example.com”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM