我有Wordpress安装在根目录,并正确configuration使用永久链接。 除了WordPress的博客,我还有一个完整的自定义开发的PHP应用程序与几个页面。 我想不显示任何自定义页面的.php扩展名,但我现在得到所有的自定义PHP页面的404错误。 http:// url / blog-title-here (单词新闻页面 – 作品) http:// url / register (自定义php页面 – 结果在404) 以下是我的.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> 这里是我在httpd.conf中的 <Directory /> Options FollowSymLinks AllowOverride All RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond […]
我的网站是非www ,它在子目录中有wordpress,在根目录和其他子目录中有一些静态的网页 我想从根目录中的网页和其他静态网页子目录中删除.html扩展。 最后加斜线。 301使用斜杠从非斜杠redirect到url。 所以应该是 /articles.html 到 / articles / 和 /subdirectory/book.html 到 /子目录/ book / 下面的代码 最后用非斜线工作 使用斜杠将301redirect到非 这是我的.htaccess <IfModule mod_rewrite.c> Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / #removing trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ $1 [R=301,L] #www to non RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?domain\.com)$ [NC] RewriteRule .? http://%1%{REQUEST_URI} [R=301,L] #html RewriteCond %{REQUEST_FILENAME} !-f […]
我有一个Django Web应用程序托pipe在AWS Elastic Beanstalk与Docker和Nginx中。 我正在使用主pipe来启动nginx和uwsgi。 需要使用密码保护网站。 我试过使用.htaccess 。 htpasswd -cb /etc/nginx/.htpasswd admin admin 并添加了nginxconfiguration location / { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; uwsgi_pass unix:/var/sockets/api.sock; include /home/docker/uwsgi_params; } 它的工作,但它反复询问密码。 通常htaccess只会在会话中要求密码一次。 但是每次我们点击一个字段或button,都会要求input用户名和密码。 有什么办法可以解决吗?
我在安装在我的网站上的第三方JavaScript游戏遇到问题,在那里返回的内容types响应头是application/json而不是application/javascript ,被请求的资源是jsonp。 这似乎不是在Safari或Firefox的问题,但它在Chrome中抛出一个错误。 我在控制台中得到的错误是Refused to execute script from 'http://example.come/js/game/data/game-data.json' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled. 基于一个推荐的configuration ,我已经尝试将以下内容添加到游戏根目录中的.htaccess文件,但它似乎没有任何影响: <IfModule mod_mime.c> AddType application/javascript jsonp </IfModule> 我已经确认在我的httd.conf文件中启用了LoadModule mime_module modules/mod_mime.so 。 有其他设置我需要尝试?
我有我的.htaccess文件的这个问题。 Google在网站站长工具中有一些我不想要的url(404错误)。 我需要重写包含– , /-或结尾的url,例如: replace–与- 删除-后/ 删除结尾- …但只有当URL不包含product_info.php 。 我尝试过,但它不工作… RewriteCond %{REQUEST_URI} !^/product_info\.php(.*)$ RewriteRule ^(.*)–(.*)$ /$1-$2 [L,R=301] RewriteRule ^(.*)/-(.*)$ /$1/$2 [L,R=301] RewriteRule ^(.*)-$ /$1$2 [L,R=301] 这是一个Magento电子商店与激活清漆caching。 编辑#1: 是的,他们出现在404错误报告! 不工作我的意思是:Magento说:“这个文件已经搬到这里”。 如果我点击那里,有一个“ESI块错误” product_info.php?product=TestProduct–Green–XXL之后可以有东西 在这种情况下,我不想replace– – = – >这是我想的问题。 编辑#2: 这是完整的.htaccess 。 我删除了评论期望redirect我试图得到工作,因为很多的空间。 DirectoryIndex index.php <IfModule mod_php5.c> php_value memory_limit 6144M php_value max_execution_time 18000 php_flag magic_quotes_gpc off php_flag […]
我有一个文件夹充满了json文件的文件夹。 我想限制对这些文件的AJAX请求到某些域。 我做了一个htaccess文件来限制这个,但它是行不通的。 我的htaccess如下: <FilesMatch "\.json$"> <RequireAny> Require host thedomain.com Require host thehurts.com </RequireAny> </FilesMatch> 这阻止了每个人,包括我自己。 我读了Require local给我自己的访问权限,但是当我添加它的时候没有任何作用。 如果我添加Require all granted我有访问,并可以从其他域的文件AJAX,但也可以访问互联网上的每个人,这是我不想要的。 有任何想法吗?
这是我需要做的。 将sub1.domain1.co.ukredirect到sub2.domain2.com 将sub2.domain2.comredirect到sub2.domain2.com/sub-folder 这两个工作,但这不: 直接导航到sub1.domain1.co.uk/sub-folder不会redirect到sub2.domain2.com/sub-folder 。 这是我的redirect: RedirectMatch ^/$ http://sub2.domain2.com/sub-folder RewriteCond %{HTTP_HOST} ^sub1.domain1.co.uk$ [NC] RewriteRule (.*) sub2.domain2.com/$1 [R=301,L]
我在AWS上有一个EC2。 configuration服务器(Apache 2,PHP 7.0,…),启用mod_rewrite。 我之前做了很多次这个过程,但从来没有在Ubuntu 16.04上做过。 毕竟,testing我的服务器我观察到: RewriteRules可以工作,但是如果它改变了URL或扩展名则不行。 例: 这不工作: <IfModule mod_rewrite.c> SetEnv HTTP_MOD_REWRITE On AcceptPathInfo On RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^dieta/([\w-]+)?/?([\w-]+)?/?$ dieta.php?usuario_id=$1&dieta_id=$2 [L,QSA] RewriteRule ^diario/([\w-]+)?/?([\w-]+)?/?$ diario.php?usuario_id=$1&data_registro=$2 [L,QSA] RewriteRule ^diario-fisico/([\w-]+)?/?([\w-]+)?/?$ diario-fisico.php?usuario_id=$1&data=$2 [L,QSA] RewriteRule ^treino/([\w-]+)?/?([\w-]+)?/?$ treino.php?usuario_id=$1&treino_id=$2 [L,QSA] </IfModule> <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascri$ </IfModule> 在这个例子中: www.link.com/dieta/50/20 […]
目前在Dreamhost的dreampress上设置的共享主机的.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 我已经尝试了我可以find的每个例子(在这个网站和其他人),但我不断收到无限循环redirect。 以下是我迄今为止尝试过的一些不同的解决scheme:(在当前的WordPress规则testing之前, RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.[REDACTED].com/$1 [R,L] 也试过了(当前wordpress规则之前和之后): RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] 也试过了(当前wordpress规则之前和之后): RewriteCond %{HTTPS} !on RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] 也尝试了在Dreamhost自己的网站上列出的内容: https://help.dreamhost.com/hc/en-us/articles/215747758-How-do-I-force-my-site-to-load-securely-with-an-htaccess-file- […]
我正在尝试将客户端的网站移到新的服务器上。 mod_rewrite肯定是启用的。 testing地址是http://176.32.230.45/hubbwayhire.co.uk/加载正常。 http://176.32.230.45/hubbwayhire.co.uk/about.php也加载罚款。 我在htaccess中有这个 RewriteEngine On RewriteBase / RewriteRule ^about about.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 但加载以下内容: http : //176.32.230.45/hubbwayhire.co.uk/about给我以下内容: Forbidden You don't have permission to access /about.php on this server. 权限也完全没问题。 服务器所有者根本无法帮助我们。 任何帮助赞赏?