Forum Moderators: coopster

Message Too Old, No Replies

Checking if mod rewrite is available

         

Nutter

11:33 pm on Jan 13, 2007 (gmt 0)

10+ Year Member



I'm working on a program that will have the option to show links as either /index.php?p=123 or /page_123_title. I'd like to disable the option to use the SE friendly URLs if mod_rewrite isn't supported. Is there a way to check using PHP? It looks like I'd need some way of checking whether Apache allows overrides through htaccess. Is there a way to check that through a script?

eelixduppy

2:43 am on Jan 14, 2007 (gmt 0)



I do not think there is a way, but I can definitely be wrong. Disable friendly URIs by default but show a checkbox where one can enable it if they want. Or you can do it the other way around: have it enabled as default and have a checkbox to disable it. I don't know...

Good luck! :)

Nutter

3:31 am on Jan 14, 2007 (gmt 0)

10+ Year Member



I think you're probably right about disabling by default. That and I need to put a big help button right next to it b/c I'm targeting non-techie types :)

Secondary question. Is there a way to tell if the server is Apache?

eelixduppy

3:53 am on Jan 14, 2007 (gmt 0)



I believe searching for 'Apache' in
$_SERVER['SERVER_SOFTWARE']
should do the trick.

barns101

1:34 pm on Jan 14, 2007 (gmt 0)

10+ Year Member



phpinfo() [php.net] will give you the answer to both of your questions. :)

eelixduppy

1:42 pm on Jan 14, 2007 (gmt 0)



Yes, barns101, it does, but I think he wants to be able to check with a script and not have to look at it with human eyes :)

I guess the script could technically 'make' a phpinfo page, request it, search for the corresponding values, then delete the file, but this seems a little unnecessary.

barns101

3:49 pm on Jan 14, 2007 (gmt 0)

10+ Year Member



Ah I see. I was under the impression that he didn't know if his host had enabled it.