Osman
Osman

Reputation: 1771

.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

Upvotes: 1

Views: 1531

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

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]

Upvotes: 1

Related Questions