htaccess的URL路径选择子目录 [英] .htaccess url routing subdirectory
问题描述
我看了一下htaccess的至少100个职位,并不能似乎得到它的把握。一切我试过导致404错误,我知道它的工作原理,因为如果我键入一行随机性的,它提供了不同的错误。我所要做的就是URL路由,以同样的方式,你会与一个索引页,有一个子域。
我有一个文件routing.php这需要链接的那个来后它的部件和包括基于在创建不同的页面的文件。
EX: mydomain.com/secure/routing/application
要通过路由给它的变量应用路线,以便 routing.php
可以构建应用程序。 mydomain.com/secure/routing/login
要通过路由给它的变量登录从而建立一个登录页面的路线。
我有 routing.php
所有设置。含击穿,将任何网址 mydomain.com/secure/routing /
到 mydomain.com/secure/routing.php
不管是什么来的路由后。
我的最新尝试:(放在/安全子目录)
选项+了FollowSymLinks
IndexIgnore * / *
#开启RewriteEngine叙述
RewriteEngine叙述上
#规则
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则。 routing.php
尝试:
选项+了FollowSymLinks
IndexIgnore * / *
#开启RewriteEngine叙述
RewriteEngine叙述上
的RewriteBase /安全/
#规则
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^路由/? routing.php [L]
I have read at least 100 posts about .htaccess and cant seem to get a grasp of it. Everything i tried resulted in the 404 error and I know it works because if I type a line of randomness it gives a different error. What I am trying to do is url routing, the same way you would with an index page, with a subdomain.
I have a file routing.php which takes the parts of the url that come after it and includes files based on that creating different pages.
EX: mydomain.com/secure/routing/application
should route through routing giving it the variable application so routing.php
can build the application. mydomain.com/secure/routing/login
should route through routing giving it the variable login thus building a login page.
I have the routing.php
all set up. The breakdown, route any url containing mydomain.com/secure/routing/
to mydomain.com/secure/routing.php
no matter what comes after routing.
My latest attempt:(placed in the /secure subdirectory)
Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . routing.php
Try:
Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
RewriteBase /secure/
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^routing/? routing.php [L]
这篇关于htaccess的URL路径选择子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!