Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.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
htaccess将which重写为index.php/view/which_Php_.htaccess - Fatal编程技术网

htaccess将which重写为index.php/view/which

htaccess将which重写为index.php/view/which,php,.htaccess,Php,.htaccess,我想要 指 domain.com/whatever 用户仍会在浏览器中看到domain.com/whatever,但在幕后它会浏览domain.com/index.php/view/whatever在域根目录的.htaccess文件中尝试此操作 domain.com/index.php/view/whatever 最后一个视图是index.php的参数,即index.php?view=还是index.php\view都是一个目录?@ulrich正如您所见index.php/view正常工作。

我想要

domain.com/whatever

用户仍会在浏览器中看到
domain.com/whatever
,但在幕后它会浏览
domain.com/index.php/view/whatever

在域根目录的.htaccess文件中尝试此操作

domain.com/index.php/view/whatever

最后一个视图是index.php的参数,即
index.php?view=
还是
index.php\view
都是一个目录?@ulrich正如您所见
index.php/view
正常工作。如果我尝试去
test.doamin.com/随便什么
。它应该访问页面
test.domain.com/index.php/view/whatever
。有什么遗漏吗?我将问题编辑成一个更简单的版本,将子问题从等式中排除。也许这会有帮助当你进入
test.domain.com时会发生什么。不管什么
例如,你有404吗?文件夹
index.php/view/
在您域的根文件夹中吗?我什么都没有得到。没有错误。视图是动态生成的,不是文件夹。让我们排除sub,不要像我最初要求的那样担心它。因为按照您的方式,如果url中没有sudomain,它会抛出错误,我现在不需要子部分。
RewriteEngine On
RewriteBase /

#for all subdomains of domain.com
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/index\.php/view.*$ [NC]
RewriteRule ^(.*)$ index.php/view/$1 [L]