htaccess的URL路径选择子目录

编程入门 行业动态 更新时间:2024-10-25 12:28:04
本文介绍了htaccess的URL路径选择子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我看了一下htaccess的至少100个职位,并不能似乎得到它的把握。一切我试过导致404错误,我知道它的工作原理,因为如果我键入一行随机性的,它提供了不同的错误。我所要做的就是URL路由,以同样的方式,你会与一个索引页,有一个子域。

我有一个文件routing.php这需要链接的那个来后它的部件和包括基于在创建不同的页面的文件。

EX: mydomain/secure/routing/application 要通过路由给它的变量应用路线,以便 routing.php 可以构建应用程序。 mydomain/secure/routing/login 要通过路由给它的变量登录从而建立一个登录页面的路线。

我有 routing.php 所有设置。含击穿,将任何网址 mydomain/secure/routing / 到 mydomain/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/secure/routing/application should route through routing giving it the variable application so routing.php can build the application. mydomain/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/secure/routing/ to mydomain/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路径选择子目录

本文发布于:2023-11-01 23:25:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550711.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:子目录   路径   htaccess   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!