Discussion
solving alt_urls with .htaccess(back to index)The first thing you should do is find out what you are running on your server by using phpinfo() -- just create a php file that contains nothing more than
<? phpinfo(1); ?>
and name it info.php -- when you load it from your web server, it will tell you php installation details. Be careful if you consider generating all your phpinfo details with just phpinfo() and providing a link to this page. Some details, particularly environment details, can be useful to those wanting to crack your security. phpinfo(1); may suffice for what we're looking for here, which is the server API and the configure command particularly.
If the server API is CGI, then that's preventing you from using the feature of folderblog that rewrites your URIs for you to remove the pesky '?p=' and you will need to use mod_rewrite from .htacess. Writing the rules can be tricky and will fail if mod_rewrite is not enabled but these two lines should get your rewriting running if you save them to a file named ".htacess" and upload it to the directory from which you run folderblog:
RewriteEngine On
RewriteRule ^fb.php(.+) fb.php?p=$1
** Be sure to change the fb.php filename to whatever you use if you have changed it from the default, and change both of them!
If you follow these instructions to the T, you should set $use_alt_url to 0 in your fb_settings.php file and that's that.
p.s. phpinfo(8); will tell you what modules you have enabled on your server. Particularly, you can find out if exif is installed or not. Alternatively, look at phpinfo(1) for the configure command and if it says '--enable-exif' in there, you're ready. If it says '--with-exif', you're not enabled to use the exif extension.
posted by
geoff on 10 Nov 05 at 6:15 PM
geoff
My server API is CGI and Netfirms only allows .htaccess usage for password protecting dirs, nothing else. I use WordPress and can't use permalinks b/c of this restriction. Netfirms support says it is an option they are considering giving to us.
richard
until then I guess
oh..and I notice I was misspelling .htaccess in my post.
don't any of you make that same mistake!!
posted by
geoff on 10 Nov 05 at 7:00 PM
Geoff, what do you think about writing some code lines which provide exactly the above described functionality? Something like
if (phpinfo tells that alt_urls have to be used) { create that .htaccess in the main directory AND set internal fb variable $use_alt_url=true; }
By this we could avoid a lot of worries of future folderblog users. You could add these lines simply at the beginning of fb.php
posted by
ikue on 11 Nov 05 at 2:20 AM
interesting idea, never heard of it before and I wonder if it's feasible.
#1 issue is using php to create .htaccess files. has that been done? can it be done? never thought or heard of it before.
#2 parsing info from phpinfo is also new me too. I haven't seen or heard of it used in a script. I wonder if it can be effectively done or not.
I see that doing this would be a nice feature of a software for the masses, checking server information to find out if an .htaccess needs to be made. But it should only be run once, preferably from an admin interface.
posted by geoff on 11 Nov 05 at 3:16 AM
and with experimenting on this on a home and web server I find the only failsafe way to build the rewrite rule is this:
RewriteEngine On
RewriteRule ^fb.php(.+) /fb/fb.php?p=$1
Which is different from above only in that the full path directory is specified as /fb/
Of course if you would put folderblog in a directory called personal on your server, you would specify /personal/fb/fb.php
posted by geoff on 11 Nov 05 at 3:38 AM
Although I never programmed such a function specifically, I am sure it is possible. And why should you not be able to read out the phpinfo()?? It is a normal PHP function.
I expect your suggestions for an appropriate source code. ;)
posted by ikue on 12 Nov 05 at 10:25 AM
it is a normal PHP function, but it doesn't produce an array of information, which would be helpful for these purposes. I guess you could parse the string output of phpinfo(1), or you could use get_loaded_extensions() to check for exif or gd, which would likely be wiser. If there's some other simple function to find out if PHP is running as CGI or not, phpinfo() wouldn't need to be used.
Also, I've found a way to get clean URLs -without the index.php and would like to know if others can get it to work on their systems. See the post Clean URL Difficulties.
If the intended plan there works on most systems, I'd want to focus on providing code that does that rather than mess around with this method.
posted by geoff on 12 Nov 05 at 4:49 PM
interesting
posted by anon on 3 Feb 06 at 12:22 AM
Post a Reply:
(back to index)