我有一个.htaccess文件在我的public_html目录下面的规则: <IfModule litespeed> php_flag zlib.output_compression On php_value zlib.output_compression_level 2 php_value session.gc_maxlifetime 200000 php_flag display_startup_errors On php_flag html_errors On php_flag ignore_repeated_errors Off php_flag ignore_repeated_source Off php_flag report_memleaks On php_flag track_errors On php_value log_errors_max_len 0 php_flag display_errors Off php_flag log_errors On php_value error_log errors.log php_value max_execution_time 600 php_value max_input_time 600 php_value max_input_vars 100000 </IfModule> 他们工作正常,通过phpinfo();确认phpinfo(); 但是,当我将.htaccess文件放在一个子目录中时,假定要覆盖上面的规则,它们被完全忽略,只有上述规则正在工作。 例如,我已经在我的public_html […]
我试图将我的Apache访问控制指令从较旧的Order,Allow和Deny移到新的Require。 不幸的是,用了这么久的旧路,我无法想出新的办法。 基本上,我想拒绝访问除了几个IP地址的每个人。 使用旧的格式,我有: Order Deny,Allow Deny from all Allow from 192.168.123.123 Allow from 123.123.123.123 我认为这应该是这样的: Require all denied Require ip 192.168.123.123 Require ip 123.123.123.123 这似乎工作。 但我不确定我是不是应该像“老路”那样思考。 也许我应该使用RequireAll或RequireAny一些,或者即使我应该嵌套它们。
redirect – http://www.domain.com – http://domain.com – https://www.domain.com 到https://domain.com 即时通讯使用以下(Apache)htaccess的: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L] </IfModule> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} […]
我需要帮助来build立我的.htaccess所以它适用于两种不同的条件。 第一个条件是: RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(.*) $1 [L] RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L] 我想添加一个条件,重写非www www 我如何强制www。 在我的网站上? 我想通过htaccess强制www,但我不知道如何去做到这一点。
我有一个htaccess文件,开始如下所示: RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} where-can-i-find-information-about-homer-training RewriteRule ^(.*)$ http://usersupport.homerenergy.com/customer/en/portal/articles/2186858-where-can-i-find-information-about-homer-training-? [R=301,L] RewriteCond %{QUERY_STRING} is-homer-pro-conservative-in-its-predictions RewriteRule ^(.*)$ http://usersupport.homerenergy.com/customer/en/portal/articles/2186859-is-homer-pro-conservative-in-its-predictions-? [R=301,L] … 继续执行308条更类似的规则。 如您所见,这意味着将一列文章从一个网站redirect到另一个网站,其中匹配元素是GETstring的查询部分中的文章名称。 如果我只是在文件中放入一对或两对RewriteCond / RewriteRule ,这是RewriteRule的。 但是,当我使用整个文件,我得到一个500内部服务器错误。 显然,其中一个规则是导致错误,但扫描文件,我不明白这是什么。 看看错误日志,我可以看到这样的消息: /var/www/html/.htaccess: RewriteCond: bad argument line '%{QUERY_STRING}' 这并没有告诉我很多。 我怎么知道哪个规则导致这个错误?
通过htaccess文件我试图redirect/services /services/onetime但它redirect到/services/onetime/onetime/onetime/… 代码有什么问题,有没有办法做到这一点? 这是我用过的代码: redirect 301 /services/ /services/onetime/
我尝试将所有请求从一个域redirect到一个子域,除了/mypath和下面的所有东西。 例子: example.com -> sub.example.com example.com/somestuff -> sub.example.com 但是example.com/my-path不应该被redirect。 这里是负责configuration的部分: RewriteCond %{HTTP_HOST} ^example.com$ RewriteCond %{REQUEST_URI} !^/my-path/ RewriteRule ^/?(.*)$ "http\:\/\/sub\.example\.com" [R=301,L] 问题是我无法实现目标,我不知道这里有什么问题。 我试图find一个实现相同的目标,但没有运气的例子。
这是我的apache 2.4虚拟主机configuration <VirtualHost *:80> DocumentRoot /var/www/fd-pro/app-api/public_html ServerName subdomain.domain.com.au ServerAlias subdomain.domain.com.au <Directory /var/www/fd-pro/app-api/public_html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/subdomain-error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/subdomain-access.log combined </VirtualHost> 我也启用了重写模块。 在/ var / www / fd-pro / app-api / public_html中有一个htaccess 话 Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header set […]
我有一个问题,我近两个月来一直无法解决。 我已经build立: 在GoDaddy帐户的子域名中,我创build了Alogging并将其指向IP地址。 我的GCE实例的地址…我想我的Nginxconfiguration没问题。 我的问题是,当我访问我的网站的URL,它会显示IP地址,而不是mysubdomain.example.com 。 我不想让我的IP地址显示我想要在浏览器中可见的URL中的子域名。 我的疑问是我的laravel应用程序的.htaccess导致IP地址始终显示在URL中。 在老爹帐户,这是我如何创build在DNSpipe理。 type=A, Host=mysubdomain, Point to=ip address, ttl=1. 也在下面有子域的转发部分,我点击添加button,我inputmysubdomain,转发到http:// ip地址,forwrd type = permanent(301),settings =只转发 这是我的服务器GCE中的Nginxconfiguration server { listen 80; listen [::]:80; root /var/www/pro1/public/; # Add index.php to the list if you are using PHP index index.php index.html index.htm; server_name mysubdomain.example.com; location / { # First attempt to serve […]
指向相同cPanel帐户的多个别名域共享相同的.htaccess文件。 只有在以下情况下,我需要一个特定于域的规则,将所有来自aliasdomain.comstream量redirect到https://www.domain1.com 。 HTTP_HOST目前是aliasdomain.com (有或没有WWW和http / https) 排除文件夹/medias/ – 它仍然可以从aliasdomain.com访问 排除所有*.jpg , *.jpeg , *.png和*.gif文件(即使文件位于aliasdomain.com根目录中) 总是redirect到https://www.domain1.com root,没有通配符redirect,也没有redirect到非ssl http domain1.com需要被排除,所以如果相同的.htaccess文件是在domain1.com它不会干涉。 我试图适应在StackOverflow上find的各种代码片段,但失败了可怕得到它的工作:(我问了一个问题,但MODS告诉我要问ServerFault,所以我在这里…帮助将非常感激!