Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将子域作为post数据发送_Php_.htaccess_Seo - Fatal编程技术网

Php 将子域作为post数据发送

Php 将子域作为post数据发送,php,.htaccess,seo,Php,.htaccess,Seo,在过去的几个小时里,我一直在寻找解决方案,我想我应该在这里问一下 我正在寻找处理链接的方法,例如: 因此,它们以以下形式传递到服务器: index.php可以使用它来显示正确的页面信息 我可以让页面和子页面工作,但不知道如何获得子域。注意:如果没有子域,我希望该字段留空或包含默认值 如有任何帮助,将不胜感激。:) 编辑: 为了澄清,我希望第一个URL是用户看到的并可以输入到地址栏中的内容,第二个URL是当用户导航到第一个URL时服务器加载的页面 我的.htaccess文件 Options +

在过去的几个小时里,我一直在寻找解决方案,我想我应该在这里问一下

我正在寻找处理链接的方法,例如:

因此,它们以以下形式传递到服务器:

index.php可以使用它来显示正确的页面信息

我可以让页面和子页面工作,但不知道如何获得子域。注意:如果没有子域,我希望该字段留空或包含默认值

如有任何帮助,将不胜感激。:)

编辑:
为了澄清,我希望第一个URL是用户看到的并可以输入到地址栏中的内容,第二个URL是当用户导航到第一个URL时服务器加载的页面

我的.htaccess文件

Options +FollowSymlinks -MultiViews -Indexes

RewriteEngine On
RewriteBase /

# Remove 'www'
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Add slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://resolutiongaming.com/$1/ [L,R=301]

# Subdomain redirect
RewriteCond %{HTTP_HOST} ^resolutiongaming.com$
RewriteRule ^webdev/$ http://webdev.resolutiongaming.com [R=301,L]
RewriteRule ^artwork/$ http://artwork.resolutiongaming.com [R=301,L]
RewriteRule ^music/$ http://music.resolutiongaming.com [R=301,L]

ErrorDocument 404 /error.php

您可以在根目录中的一个.htacces文件中尝试此操作:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}  ^(?:www\.)?([^\.]+)\.domain\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}  ^/([^/]+)/([^/]+)/?   [NC]
RewriteRule .*     http://domain.com/index.php?subdomain=%1&page=%2&subpage=%3  [R=301,L]
它将永久重定向:

http://subdomain.domain.com/page/subpage/
http://www.subdomain.domain.com/page/subpage/

致:

http://domain.com/index.php?subdomain=subdomain&page=page&subpage=subpage

要使规则起作用,必须保留传入的URL方案:
/page/subpage/


要将永久重定向替换为静默映射,请从[R=301,L]中删除
R=301
,或将其替换为
R
,以实现暂时重定向。

通过GET方法发送数据我想您正在寻找mod_rewrite,签出这似乎很有希望,但由于某些原因不起作用。我认为这可能与webhost(000webhost)不识别子域有关。我已经用我的htaccess文件更新了我的原始问题,但我会接受这个答案,因为它似乎正是我想要的。