标签: .htaccess

这是在 Apache 2.4.7 中启用 htaccess 的正确方法吗

在几乎每个“如何激活htaccess”的解决方案中,他们都说需要编辑/etc/apache2/sites-available/default文件。但是Apache 2.4.7中没有这样的文件

我在某处读到新的默认文件是 000-default.conf。所以我编辑了那个并尝试添加以下行:

AllowOverride All
Run Code Online (Sandbox Code Playgroud)

但是Apache2没有正确重启并报错。从 apache2 文档中,我发现 AllowOverride 只允许在该<Directory>部分下。然后我尝试添加这个:

<Directory "/var/www">
AllowOverride All
</Directory>
Run Code Online (Sandbox Code Playgroud)

这似乎有效。但我不确定是否应该将 /var/www 放在那里。这是正确的做法还是我的电脑会以某种方式炸毁?

configuration apache2 .htaccess

52
推荐指数
2
解决办法
23万
查看次数

启用 .htaccess 文件重写路径(不起作用)

所有的教程都告诉我编辑:/etc/apache2/sites-available/default但这个文件对我来说不存在。在这个文件中,我必须编辑:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews        
Order allow,deny
allow from all </Directory>
Run Code Online (Sandbox Code Playgroud)

文件应该是什么样的,我应该自己创建吗?

Aslo我确实有一个000-default.conf文件,但上面的“代码”也不在那里。

apache2 mod-rewrite .htaccess

22
推荐指数
3
解决办法
15万
查看次数

.htaccess 错误:无效的命令“AuthGroupFile”

在此之前,我在 Windows 上工作,我的项目运行正常。最近我搬到了 ubuntu,我正在尝试在 LAMP 上安装项目。

我为此创建了主机(Windows 我直接通过本地主机运行),当我运行它时出现 500 内部服务器错误。

当我查看我的日志文件时,我得到了无效的命令“AuthGroupFile”,可能拼写错误或由服务器配置中未包含的模块定义。

.htaccess 文件

#php_value zend.ze1_compatibility_mode off
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /opt/lampp/htdocs/uniplex_mobile/.htpasswd 
AuthGroupFile /dev/null 

<Files manageurls.html>
require valid-user
</Files>
<Files addurl.html>
require valid-user
</Files>
<Files editurl.html>
require valid-user
</Files>

AddType application/x-httpd-php .php .htm .html
Run Code Online (Sandbox Code Playgroud)

我的项目是在 smarty 框架上。

任何人都可以帮助解决这个问题吗?

提前致谢

lamp .htaccess 14.04

15
推荐指数
1
解决办法
3万
查看次数

为什么我在 LAMP 永久链接上得到 404(使用 wordpress)

我一直在 ubuntu 服务器(amazone)上的一个网站上工作,我得到 404s 进入页面。

我将提供有关该问题的所有信息。

在 WordPress 上

在此处输入图片说明

在此处输入图片说明

刷新页面:

在此处输入图片说明

我跟着这个教程:

https://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010?replies=6

没有任何帮助。

我发现这篇文章https://wordpress.org/support/topic/permalink-does-not-work-apart-from-default?replies=12 - 所以我输入了我输入的文件:/etc/apache2/sites-enabled/000-default.conf

并没有找到AllowOverride None更改为AllowOverride All所以我自己在这里添加了它: 在此处输入图片说明

重新启动 apache,出现错误。我刷新了网站,发现它不起作用..

撤消AllowOverride All000-default.conf

解决这个问题的方法是什么?我从未使用过 Linux 服务器,所以我需要一个非常清晰且解释清楚的答案。

顺便说一句,这是 WP 在我的 .htaccess 文件中生成的内容:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Run Code Online (Sandbox Code Playgroud)

lamp apache2 wordpress mod-rewrite .htaccess

5
推荐指数
1
解决办法
5052
查看次数

.htaccess 不工作(apache2 | ubuntu 18.04)

伙计们,网站运行良好,只是文件 .htaccess 不起作用,我用谷歌搜索了很多,已经启用a2enmod rewrite并尝试了很多东西,但没有用。

obs:我以网站example.com为例

这就是我/etc/apache2/sites-available/000-default.conf的:

<VirtualHost *:80>

    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这就是我/etc/apache2/apache2.conf的:

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)

我的 .htaccess 是这样的:

#DISALOW DIRECTORY LISTING
Options -Indexes

ErrorDocument 400 /.error.php
ErrorDocument 401 /.error.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 405 …
Run Code Online (Sandbox Code Playgroud)

apache2 .htaccess

5
推荐指数
1
解决办法
2956
查看次数

启用 mod_rewrite 模块后如何配置 htaccess 文件?

我已经安装apache2然后我mod_rewrite像这样启用模块:

sudo a2enmod rewrite
Run Code Online (Sandbox Code Playgroud)

启用后,我对这些行感到困惑,我无法理解如何处理它们,据我所知,我必须对这些行做的是“找到以下部分,然后更改表示 AllowOverride 的行没有对所有人。”

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)

我的问题是我找不到包含上述行进行编辑的文件。我已经看过了/etc/apache2/sites-available/。在那个目录中,我只找到了两个文件:

000-default.conf 
default-ssl.conf 
Run Code Online (Sandbox Code Playgroud)

在这两个文件中,我都找不到上面需要编辑的行。

我编辑了/etc/apache2/apache2.conf这个目录中的文件 ,但它仍然没有工作。

我也查看了这个/etc/apache/sites-enabled/default.conf目录,但我找不到这些行dafault.conf

<Directory /var/www/html>
    AllowOverride All
</Directory>
Run Code Online (Sandbox Code Playgroud)

我在/var/www/html目录中工作,那么为什么它给我 403 禁止错误。

仍然.htaccess没有运行。它给了我 403 禁止错误。

这是文件夹权限的屏幕截图:

在此处输入图片说明

这是 403 禁止错误的屏幕截图: 在此处输入图片说明

apache2 webserver mod-rewrite .htaccess 14.04

4
推荐指数
1
解决办法
2万
查看次数

文件 .htaccess 消失

我安装了 ubuntu 并想放置我的 Web 脚本 (php) 当我通过 USB 放置文件时会发生什么是 USB .htaccess 消失了。有人可以帮助我吗?

nautilus hidden-files .htaccess

1
推荐指数
1
解决办法
349
查看次数

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

一个问题问了很多次,但我没有找到对我有帮助的答案。

我有一个在 Ubuntu 12.04.5 LTS 下运行的 Apache 服务器(是的,我需要更新)。

我有一个网页 /var/www/website/index.html

我已在我的提供商处将域转发设置为
https://ip.address/website/index.hmtl

我有一个.htaccess文件,/home/website/其中读取

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
Options Indexes
DirectoryIndex index.html       
order deny,allow
Run Code Online (Sandbox Code Playgroud)

我已经
LoadModule rewrite_module modules/mod_rewrite.so
在我的/etc/apache2/apache2.conf

尝试访问该网站时,出现错误 The requested URL /website/index.html was not found on this server.

这是我第一次做这样的事情,我完全不知所措...为什么我不能访问我的页面?

更新:我现在按照https://debian-administration.org/article/412/Hosting_multiple_websites_with_Apache2设置所有内容

现在我收到浏览器无法连接到服务器的错误消息?

UPDATE2:我现在error.log在我的网站目录中有一个文件说 [Wed Dec 07 08:23:10 2016] [error] (2)No such file or directory: could not open transfer log file /home/www/website/logs/access.log.

server apache2 .htaccess

1
推荐指数
1
解决办法
5万
查看次数