使用此 htaccess 设置,我无法连接到我的网站

发布时间:2021-02-25 08:44

我的问题是我有一个专门为我制作的在线网站。现在我已经在我的 wamp 上本地下载了该站点,因为我想进行一些更改。 该网站位于名为拍卖的文件夹下。所以在 wamp64/www/auctions/index.php 下找到 index.php 所有这一切都是为了告诉你,如果我去浏览器的本地主机我无法进入登录页面,我总是会出错,我唯一明白的是问题是 htaccess。 如果有人能理解这个问题,我会附上一个到 github 的链接以参与该网站。

https://github.com/CP1975/htaccess

Wamp mod_rewrite 已启用。

我用这个 htaccess 代码输入 http://localhost/aste 数字:

Options -Indexes

#BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
#END HTTPS Redirection Plugin

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

#add a trailing slash to /ios-admin
RewriteRule ^ios-admin$ ios-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(ios-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE image/jpg
AddOutputFilterByType DEFLATE image/jpeg
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/png
AddType image/svg+xml .svg
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

##EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"  
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</IfModule>
##EXPIRES CACHING ##

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

系统跳转到以下网址:

http://localhost/en/login

我收到了这个错误:

**未找到。

在此服务器上找不到请求的 URL。

Apache/2.4.46 (Win64) PHP/7.3.21 服务器在本地主机端口 80**

谢谢 查尔斯

回答1

问题总结

  • 您访问此网址:http://localhost/aste
  • 系统会将您转发至:http://localhost/en/login
  • 您收到错误 /en/login cannot be found

可能的解决方案

你可能会说它应该是 http://localhost/aste/en/login

其中任何一个都应该有效。无法帮助您解决所有问题:

  • 您将所有文件向上移动一个文件夹。如果这是您唯一的网络项目,这可能是最简单的。
  • 配置基本路径以添加 /aste(如果您知道可以配置的位置)
  • 将您的系统配置为使用子域,例如 Apache 转发到 aste.localhost 目录的 /aste。这需要一些工作,但如果您计划在您的机器上拥有多个网络项目,那就太好了。