我创建了一个传球。当我将它添加到设备时,我需要将其注册到我的服务器。我使用.htaccess代码:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?url=$1 [L,QSA]
我将此文件放在https://"myIP"/passesWebserver/
和pass.json中,我添加:"webServiceURL" : "https://"myIP"/passesWebserver/"
我不知道.htaccess文件有什么问题或者还有什么问题?
答案 0 :(得分:0)
将以下.htaccess
放入您的passWebserver文件夹中。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ passesWebserver/index.php [L]
<强>更新强>
要测试它是否正常工作,请创建一个包含
的简单index.php文件<?php
$request = explode("/", substr(@$_SERVER['REQUEST_URI'], 1));
echo '<pre>' . print_r($request, true) . '</pre>';
然后当您访问http://"myIP"/passesWebserver/v1/devices/xxx/registrations/pass.abc.def.ghi/yyy
时,您应该看到:
Array
(
[0] => passesWebserver
[1] => v1
[2] => devices
[3] => xxx
[4] => registrations
[5] => pass.abc.def.ghi
[6] => yyy
)
答案 1 :(得分:0)
这对我有用:
RewriteEngine On
RewriteRule ^(.+)/devices/(.+)/registrations/(.+)$ index.php?request=$1/devices/$2/registrations/$3 [L]
RewriteRule ^(.+)/passes/(.+)$ index.php?request=$1/passes/$2[L]
RewriteRule ^(.+)/log$ index.php?request=$1/log [L]