Commit e9d1ab5b52

e9d1ab5b5229a8888f0cf8aacd65d1810d3c54cb

parent: 30bcea7a11

Unsigned

Sergey Briskin <sergey@briskin.org> · 2014-03-08 22:26 UTC

	Updated README.md: added .htaccess example
	new file:   htaccess

Layout: unified · split

README.md +24 −11
@@ -1,18 +1,31 @@
11ifconfig.php
22============
33
4**Simple PHP script to show IP-address, UserAgent and other info**
4**Simple PHP script to show IP address, UserAgent and other info**
55
6It works exactly the same as [ifconfig.me](http://ifconfig.me) and [ifconfig.co](http://ifconfig.co).
67
7Added all basic features, such as output in HTML, plain text, XML and JSON.
8By default it will be in HTML. Also it is possible to request single value.
8Available all basic features such as output in HTML, plain text, XML and JSON.
9By default it will be in HTML. Also it is possible to request single values.
910
1011Visit some of the links below to view it in action:
11* [all in plain text](http://briskin.org/ifconfig.php?q=text)
12* [all in xml](http://briskin.org/ifconfig.php?q=xml)
13* [useragent only](http://briskin.org/ifconfig.php?q=ua)
14
15P.s.
16I've made this script only as an illustration for my article about privacy problems.
17For now I have no plans to make it more powerfull, so I would like to recommend
18you another good project [ifconfig.co](http://ifconfig.co).
12* [all in plain text](http://briskin.org/ifconfig/text)
13* [all in xml](http://briskin.org/ifconfig/xml)
14* [ip address only](http://briskin.org/ifconfig/ip)
15* [useragent only](http://briskin.org/ifconfig/ua)
16
17
18
19This is example of .htaccess rules, to make this script more user friendly:
20
21 RewriteEngine On
22
23 RewriteCond %{REQUEST_FILENAME} !-d
24 RewriteCond %{REQUEST_FILENAME} !-f
25 RewriteRule ^ifconfig$ ifconfig.php [L]
26 RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L]
27
28With this code in .htaccess file there is no need to type long line 'ifconfig.php?q='.
29Now just enough to open 'ifconfig/xml' to get XML output or 'ifconfig/ua' to determine useragent.
30
31Run `curl briskin.org/ifconfig/text` in Linux terminal to get some info.
htaccess added +6
@@ -0,0 +1,6 @@
1RewriteEngine On
2
3RewriteCond %{REQUEST_FILENAME} !-d
4RewriteCond %{REQUEST_FILENAME} !-f
5RewriteRule ^ifconfig$ ifconfig.php [L]
6RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L]