Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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/9/javascript/402.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 htaccess将目录添加到相对根请求_.htaccess - Fatal编程技术网

.htaccess htaccess将目录添加到相对根请求

.htaccess htaccess将目录添加到相对根请求,.htaccess,.htaccess,我的站点使用相对根路径,即:/\u imgs/abc.jpg/\u js/stuff.js/product/123/someproduct 因为它是在一个共享服务器上进行测试的,而且我还没有为该站点分配域,所以测试服务器的url是一个404请求 我是否可以在htaccess to prepend/~testsite中为所有url请求添加一条规则 我尝试过使用RewriteBase,但没有成功。您可以尝试以下方法:(未经测试) 这将导致您的所有页面301重定向,但对于开发来说,这应该没问题。我总是

我的站点使用相对根路径,即:/\u imgs/abc.jpg/\u js/stuff.js/product/123/someproduct

因为它是在一个共享服务器上进行测试的,而且我还没有为该站点分配域,所以测试服务器的url是一个404请求

我是否可以在htaccess to prepend/~testsite中为所有url请求添加一条规则


我尝试过使用RewriteBase,但没有成功。

您可以尝试以下方法:(未经测试)


这将导致您的所有页面301重定向,但对于开发来说,这应该没问题。

我总是创建一个新的vitualhost并向我的主机文件添加一个条目

<VirtualHost *:80>
        ServerName example
        DocumentRoot /var/www/example
</VirtualHost>

这样,网站的行为就像在普通服务器上一样。

不幸的是,由于我制定的其他规则没有正确指导。
<VirtualHost *:80>
        ServerName example
        DocumentRoot /var/www/example
</VirtualHost>
127.0.0.1  example