简体   繁体   中英

.htaccess url routing subdirectory

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM