Php 使用.htaccess创建漂亮的URL
我希望以这种格式创建漂亮的URL www.example.com/countryId/stateid,但我希望我的API端点路由到/public folder中的index.phpPhp 使用.htaccess创建漂亮的URL,php,linux,apache,.htaccess,Php,Linux,Apache,.htaccess,我希望以这种格式创建漂亮的URL www.example.com/countryId/stateid,但我希望我的API端点路由到/public folder中的index.php Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^ index.php [L] 我一直收到404的错误,我不知道我
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^ index.php [L]
我一直收到404的错误,我不知道我在哪里得到它的错误。
这是我的URL“”,我希望URL端点路由到。.htaccess文件存在于public/.htaccess中,其中index.php为请参考此答案,这将意味着重构整个应用程序,因为在某个时刻,应用程序正在以某种方式运行,您必须捕获正在重定向的url片段;否则,您将如何显示不同的页面?如果应用程序在某个时候工作,请查看它是如何获得这些信息的,这将使您了解htaccess需要如何将这些信息提供给index.php