从 url 指向 .htaccess 中目录的路径
Pointing path from url to directory in .htaccess
目前我正在使用这个 .htaccess
:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.org$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.org$
RewriteCond %{REQUEST_URI} !production/
RewriteRule (.*) /production/ [L]
所以如果我点击 mydomain.org
或 mydomain.org/*
它将指向 public_html/production
文件夹
但现在我需要特殊规则才能将 mydomain.org/api
指向文件夹 public_html/api
。
如何实现?
仅供参考...
在您的本地主机上试试这个。创建一个项目文件夹然后在你的根目录中创建一个.htaccess 文件
在 .htaccess 文件中写入以下代码
RewriteEngine On
RewriteRule ^game/([0-9]+)? http://triviamaker.com [R=301,L]
现在运行这个,
localhost/your_Project_Folder_Name/game/_any_number/ ... 当你 运行 这个 url 你会自动重定向到另一个 url在 .access 文件中设置
希望你能理解谢谢
目前我正在使用这个 .htaccess
:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.org$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.org$
RewriteCond %{REQUEST_URI} !production/
RewriteRule (.*) /production/ [L]
所以如果我点击 mydomain.org
或 mydomain.org/*
它将指向 public_html/production
文件夹
但现在我需要特殊规则才能将 mydomain.org/api
指向文件夹 public_html/api
。
如何实现?
仅供参考...
在您的本地主机上试试这个。创建一个项目文件夹然后在你的根目录中创建一个.htaccess 文件
在 .htaccess 文件中写入以下代码
RewriteEngine On
RewriteRule ^game/([0-9]+)? http://triviamaker.com [R=301,L]
现在运行这个, localhost/your_Project_Folder_Name/game/_any_number/ ... 当你 运行 这个 url 你会自动重定向到另一个 url在 .access 文件中设置
希望你能理解谢谢