apache - .htaccess 问题 PHP 目录
问题描述
我今天早上尝试隐藏 URL 中的 .php 扩展名,我在互联网上发现我可以编辑 .htaccess 文件。因此,我在“localhost/Myproject/fr/”目录中创建了 .htaccess 文件,从那时起,当我想转到“localhost/Myproject/fr/”时,它会在页面上返回:
'403 Forbidden , You don't have permission to access this resource.
Apache/2.4.46 (Win64) PHP/7.3.21 Server at localhost Port 80'
我删除了 .htaccess 文件,但它没有任何改变......我也尝试重新安装 WAMP,但它仍然是一样的。有人可以知道如何解决这个问题吗?我仍然可以访问我的项目中的其他目录,例如“localhost/Myproject/en/”。
总结一下:我没有 .htaccess 文件了,但问题仍然存在......
这是我在删除文件之前在互联网上找到的 .htaccess 的代码:
Options +FollowSymlinks
RewriteEngine on
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://localhost/site/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://localhost/site/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
RewriteCond %{HTTP_HOST} www.site.com
RewriteRule (.*) http:// site.com$1 [L,R=301]
ErrorDocument 404 http://localhost/site/erreur
解决方案
推荐阅读
- azure-ad-b2c - 你能配置tls级别吗
.b2clogin.com - php - php总是为邮递员中的空参数返回错误?
- mysql - 如何批量转换 DATETIME 条目的时区?
- push-notification - 世博会推送通知生成重复令牌
- ros - 我可以在我的电脑上运行 ROS 吗?我刚刚启动 ROS,想知道我是否可以在笔记本电脑上运行它
- c - 如何按 char 字段对结构数组进行排序,以便空字段排在最后?
- ios - UISearchBar“X”按钮不会在某些视图上触发任何事件
- sql-server - DACPAC pre-pre script avilale?
- flutter - Navigator.push().then 不调用函数
- excel - 数据类型错误,字母数字不起作用