我有多个域名运行在一个Wordpress安装,与其他网站也托管在相同的空间,是纯html。
我想创建一组htaccess重写规则,如果URL还没有"www“,它会在前面加上”www“,然后重定向到特定域名的https,而不是其他域名。
我写了以下代码,在我看来逻辑上是正确的,但在部署时会出现问题:
# Check to see if the hostname begins with www. If not, add "www" then move to the next Rule
RewriteCond %{HTTP_HOST} !^www\. [NC]
我的.htaccess文件中包含以下内容:
#when the user types the domain name only
RewriteCond %{REQUEST_FILENAME} ^$
RewriteRule . /index2.php [L]
我的目标是在用户只在浏览器地址栏中输入域名时运行index2.php。然而,该代码似乎不起作用。
我还尝试了其他变体,但都没有成功:
#when the user types the domain name only
RewriteCond ! %{REQUEST_FILENAME}
RewriteRule . /index2.php [L
我有一个Zend应用程序托管在godaddy上,它的域名指向应用程序所在的子文件夹,这会导致在使用域名时出现500服务器错误。我使用的是一台Linux主机,公共文件夹的路径是公共名称/ /Subfolder,这是域名所指向的位置。令人困惑的是,当我使用:主机IP地址/子文件夹路径导航到该站点时,没有任何问题。使用域名导航时,错误日志中会产生如下内容:
Request exceeded the limit of 10 internal redirects due to probable configuration error.
环顾四周,这似乎是一个.htaccess问题。我的公用文件夹中的.h
今天我在用php玩域名,
示例
www.wordpress.com is our main site
www.friend1.com is my new domain
www.friend2.com is my new domain
www.friend3.com is my new domain
至
www.friend1.com the same as www.wordpress.com/profile/friend1 ?
www.friend2.com the same as www.wordpress.com/profile/friend3 ?
www.friend3.com the
我试图访问这个网站中的子域名url
但我总能得到:
The requested URL /logincheck was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/7.1.11 Server at medica.mastertools.net Port 80
我发现不是服务器配置
我正在尝试用PHP编写我自己的MVC平台,用于一个学校项目,并且我的.htaccess文件面临一个问题。在阅读了几篇关于Stackoverflow的教程并阅读了这里的答案之后,我仍然没能把它做好。简单地说,我正在将请求重写到根域到index.php,然后打电话给我的路由器以获得控制器等等,除了一件事外,所有事情都很正常,有时而且没有明显的原因,我输入了一个像mydomain.com/page这样的URL,它会更改为mydomain.com/index.php?这是我的代码,一个同事有相同的代码,而且它正在工作!任何帮助都将不胜感激。谢谢
DirectoryIndex /index.php
Re