服务器:Nginx
应用程序:
有问题的URL是
/p/all_p/user/ABC
/p/all_p/user/ABC/page/123
这就是
/index.php?p=all_articles&user=ABC
/index.php?p=all_articles&user=ABC&page=123
ABC = this could be a-zA-Z0-9 as it's username
123 = this could be page numbers 0-9
尝试了许多组合和选项,以下让我更接近预期的结果,但它不是完美的。
location /
我有一个类似于的url (以http://开头,以. .php/结尾)。请确保URL末尾的斜杠(/)。
现在,我想重写URL,方法是替换URL的最后一个元素,即/contacts.php/ to /index.php/,方法是使用正则表达式匹配URL。
示例代码-
$url = "http://www.something.com/folder_path/contacts.php/";
$new_element = "index.php";
$regex = "#[^/.*](\.....?)/$#"; // what would be the
我对URL上的别名有问题。
.htaccess文件
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
我尝试使用config
'<controller:\w+>/<action:\w+>/<alias:\w+&g
我正在尝试通过htaccess将我的url重定向到domain/admin上的管理(后端)部分。我仍然不太熟悉.htaccess,到目前为止我所做的是根目录中的主.htaccess:
#adding the charset
AddDefaultCharset utf-8
#hide the structure
Options -Indexes
#if dir is symbol, follow it
Options FollowSymlinks
#engine on
RewriteEngine
#if there is admin word in the URI go on the n