Forum Moderators: phranque

Message Too Old, No Replies

another rewrite thread, unable to find answer elsewhere

         

ext103

7:50 am on May 13, 2011 (gmt 0)

10+ Year Member



hello all im new here, have signed up for this question as you all seem very good at .htaccess directives.

anyway first off a bit of background.

i have whmcs installed in a folder "whmcs" on my server.

i did have wordpress installed in the root of the domain but i have removed this now.

what i want to do leave whmcs in its sub folder, but be able to access the pages without having the folder "whmcs" in the url.

okay simple enough, i have that sorted out with a simple rewrite rule.

the problem i have now is this:


i have custom pages in whmcs which i have a rewrite rule for which redirects "whmcs/page/$" to "whmcs/page.php?p=$"


so now i have my rewrite rules in place i can access these custom pages useing:

domain.com/page/$

but what i really want to do is access them like this:

domain.com/$


i think i can use rewrite cond to stop the redirect working for all the builtin whmcs pages, but that would mean listing all the pages in the whmcs, which is quite long.

is there any way to make apache "search" for the file in the "whmcs" and if its not there search for it in the "whmcs/page" folder?

so as an example i would type in

domain.com/clientarea.php

apache would search and find this in the "whmcs" folder and display it.

but then when i type in

domain.com/custompage.php

apache would search for it in the "whmcs" folder, find its not there and then search in the "whmcs/page" folder. When it finds it it displays the page.


is this possible?

or should i look for a php solution (which i can do, but thought it would be slower than .htaccess)

g1smd

8:40 am on May 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Apache needs to know from a clue in the URL where it needs to look in the server. So you'll need some sort of prefix or marker in the URL so that you can write the correct rules to fetch the content.