Re: [PHP] Variables via url
On Sun, 2012-05-13 at 01:57 +1000, Tom Rogers wrote: Hello Ashley, Saturday, May 12, 2012, 9:15:23 AM, you wrote: Can someone point me at examples or directions on how I can pass a variable via a URL in the following way: http://server.domain.com//script///variable/ I will only be passing one single /variable/. And I want the /script/ to use that. I don't want to see what the script is, for example I don't want it to say 'script.php' or 'script.html' ... Is this possible through PHP only, or do I have to write a rewrite directive in Apache to accomplish this? You can add this to apache conf: FilesMatch ^phpscript$ ForceType application/x-httpd-php /FilesMatch Then make a file called phpscript without extension and drop it in the web root. ?php $info = explode('/', $_SERVER['PATH_INFO']); Then your url would look like: http://server.domain.com/phpscript/variable1/variable2 -- Best regards, Tom As this method requires an Apache restart, I don't see what advantage you have over using an .htaccess file? -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Variables via url
On Sat, May 12, 2012 at 12:25 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: As this method requires an Apache restart, I don't see what advantage you have over using an .htaccess file? Performance: http://httpd.apache.org/docs/current/howto/htaccess.html You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance. ...putting this configuration in your server configuration file will result in less of a performance hit, as the configuration is loaded once when httpd starts, rather than every time a file is requested. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables via url
Can someone point me at examples or directions on how I can pass a variable via a URL in the following way: http://server.domain.com//script///variable/ I will only be passing one single /variable/. And I want the /script/ to use that. I don't want to see what the script is, for example I don't want it to say 'script.php' or 'script.html' ... Is this possible through PHP only, or do I have to write a rewrite directive in Apache to accomplish this?