<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LAMPdocs: Linux, Apache, MySQL, PHP &#187; htaccess Solutions</title>
	<atom:link href="http://www.lampdocs.com/blog/category/htaccess-soultions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lampdocs.com/blog</link>
	<description>Linux, Apache, MySQL, PHP: Docs, Tricks and Secrets</description>
	<lastBuildDate>Wed, 28 Jul 2010 08:36:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to Enable register_globals in php using .htaccess</title>
		<link>http://www.lampdocs.com/blog/2010/01/how-to-enable-register_globals-in-php-using-htaccess/</link>
		<comments>http://www.lampdocs.com/blog/2010/01/how-to-enable-register_globals-in-php-using-htaccess/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 08:13:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[.htaccess register_globals]]></category>
		<category><![CDATA[enable register_globals for one site]]></category>
		<category><![CDATA[enable register_globals htaccess]]></category>
		<category><![CDATA[php enable register_globals]]></category>
		<category><![CDATA[register_globals no php.ini]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=800</guid>
		<description><![CDATA[A string to add to .htaccess to enable register_globals. ]]></description>
			<content:encoded><![CDATA[<p>As you should already know, register_globals is a php.ini directive that manages the way PHP deals with variables. It has been deprecated for security issues and we won&#8217;t see it in PHP 6.0. If the deprecated register_globals  directive is on (removed as of PHP 6.0.0), then variables_order also configures the order the ENV, GET, POST, COOKIE and SERVER variables are populated in global scope. So for example if variables_order is set to &#8220;EGPCS&#8221;, register_globals is enabled, and both $_GET['action'] and $_POST['action'] are set, then $action will contain the value of $_POST['action'] as P comes after G in our example directive value. This is extremely insecure and it is not recommended to enable this directive. </p>
<p>But if you really need it (for example, you need to transfer an old-made site to your server and make it working until all the variables are changed), you may enable it using an .htaccess file. This way register_globals will be active just for one site. Here is the string you need to add to your .htaccess file: </p>
<blockquote><p>php_value register_globals 1</p></blockquote>
<p>I wish you to change all the variables as soon as possible, but you may use my solution until then <img src='http://www.lampdocs.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.lampdocs.com/blog/2008/04/how-to-enable-register-globals-in-php-without-access-to-phpini/" title="How To Enable Register Globals in PHP Without Access to php.ini (April 26, 2008)">How To Enable Register Globals in PHP Without Access to php.ini</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2010/01/how-to-enable-register_globals-in-php-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Find The Version of Linux You Are Using</title>
		<link>http://www.lampdocs.com/blog/2009/02/how-to-find-the-version-of-linux-you-are-using/</link>
		<comments>http://www.lampdocs.com/blog/2009/02/how-to-find-the-version-of-linux-you-are-using/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 17:44:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux Tricks]]></category>
		<category><![CDATA[PHP Configuration]]></category>
		<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[command to find linux version]]></category>
		<category><![CDATA[command to identify linux version]]></category>
		<category><![CDATA[how to find linux version]]></category>
		<category><![CDATA[linux command os version]]></category>
		<category><![CDATA[linux version command line]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=663</guid>
		<description><![CDATA[Sometimes you need to know what version of the Operating system is installed on your server. This is extremely useful when you order a dedicated server and want to know what is the version of OS on it. A simple command will help you as usual: cat `ls /etc/*{-,_}{release,version} 2&#62;/dev/null &#124; head -n 1` This [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to know what version of the Operating system is installed on your server. This is extremely useful when you order a dedicated server and want to know what is the version of OS on it. A simple command will help you as usual:</p>
<blockquote><p>cat `ls /etc/*{-,_}{release,version} 2&gt;/dev/null | head -n 1`</p></blockquote>
<p>This will show you something like</p>

<a href='http://www.lampdocs.com/blog/2009/02/how-to-find-the-version-of-linux-you-are-using/uname2/' title='uname2'><img width="150" height="150" src="http://www.lampdocs.com/blog/wp-content/uploads/2009/02/uname2-150x150.jpg" class="attachment-thumbnail" alt="uname2" title="uname2" /></a>

<p>The picture below shows the difference between common commands: one shown above and <strong>uname -a</strong>. Sometimes you don&#8217;t need the kernel version, just the operating system name. This command should help you to do that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2009/02/how-to-find-the-version-of-linux-you-are-using/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>htaccess Site Redirection Without Parameters</title>
		<link>http://www.lampdocs.com/blog/2008/09/htaccess-site-redirection-without-parameters/</link>
		<comments>http://www.lampdocs.com/blog/2008/09/htaccess-site-redirection-without-parameters/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 05:11:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[htaccess redirect all pages to a new site]]></category>
		<category><![CDATA[htaccess redirect no parameters]]></category>
		<category><![CDATA[htaccess redirect without get parameters]]></category>
		<category><![CDATA[htaccess redirect without parameters]]></category>
		<category><![CDATA[htaccess site redirect]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=154</guid>
		<description><![CDATA[Sometimes you need to redirect all traffic from one site to another. Very often site structure is different and the need is to send visitors to the main page of the site. This makes Site Redirection tabs of all known panels unusable, as the parameters are being sent to the new site. For example, if [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to redirect all traffic from one site to another. Very often site structure is different and the need is to send visitors to the main page of the site. This makes Site Redirection tabs of all known panels unusable, as the parameters are being sent to the new site. For example, if you had www.oldsite.com/index.php?f=9 and you&#8217;ve set redirection to www.newsite.com/, you will be redirected to www.newsite.com/index.php?f=9.</p>
<p>Sometimes you can omit these parameters (for example, when pointing to a PHP script with at least one parameter), but most probably you won&#8217;t need this. How to hide these parameters and send your users to the main page of a new site? Here is an .htaccess solution.</p>
<p>We will need two files: .htaccess in the root directory of your site and a PHP file located anywhere you like. First of all we need to create an .htaccess file:</p>
<p><strong>RewriteEngine on<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteRule ^(.*)$ http://www.site.com/redirect.php</strong></p>
<p>What does this piece of code do? It redirects all requests to the server (<strong>^(.*)$) </strong>to a PHP file, that processes redirection. All the unnecessary parameters will be sent to this PHP file and it won&#8217;t transmit them further as it contains only one string:</p>
<p><strong>&lt;?<br />
header (&#8220;Location: http://newsite.com&#8221;);<br />
?&gt;</strong></p>
<p>Can you see the difference? None of old site parameters are sent to the new site, everything looks clear and simple.</p>
<p>I think there is a smarter solution for this, I would encourage you to post it here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/09/htaccess-site-redirection-without-parameters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Protect a Folder Using .htaccess From Command Line</title>
		<link>http://www.lampdocs.com/blog/2008/08/how-to-protect-a-folder-using-htaccess-from-command-line/</link>
		<comments>http://www.lampdocs.com/blog/2008/08/how-to-protect-a-folder-using-htaccess-from-command-line/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 13:25:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[create password file ssh]]></category>
		<category><![CDATA[htaccess add user command line]]></category>
		<category><![CDATA[htaccess command line]]></category>
		<category><![CDATA[htaccess generate password ssh]]></category>
		<category><![CDATA[htaccess shell password]]></category>
		<category><![CDATA[linux cli folder password]]></category>
		<category><![CDATA[make .htaccess from command line]]></category>
		<category><![CDATA[put .htaccess command line]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=150</guid>
		<description><![CDATA[We do often meet password protected directories on the Web. This is usually used to hide some information that should not be visible to all site users. Most common is .htaccess protection, that allows you to restrict users at Apache level and is also knows as http authentification. Today I will tell you how to [...]]]></description>
			<content:encoded><![CDATA[<p><!--[if gte mso 10]></p>
<p><mce:style><!  /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Обычная таблица"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} --></p>
<p><!--[endif]--><span lang="EN-US">We do often meet password protected directories on the Web. This is usually used to hide some information that should not be visible to all site users. Most common is .htaccess protection, that allows you to restrict users at Apache level and is also knows as http authentification. Today I will tell you how to protect your directory using command line. </span></p>
<p><span lang="EN-US">As usually we need root access to the server and need to go to the folder which is waiting to be protected. First of all we need to create an .htaccess file that should contain the information that authentification is required to access this folder. </span>The most common sample comes below:</p>
<p><strong><span lang="EN-US">AuthGroupFile /dev/null<br />
AuthName &#8220;Closed User Group&#8221;<br />
AuthType Basic<br />
AuthUserFile /path_to_htpasswd_file/.htpasswd<br />
require valid-use</span></strong><span lang="EN-US">r</span></p>
<p><span lang="EN-US">Usually <strong>.htaccess</strong> and <strong>.htpasswd</strong> files are located in the same folder, but you can move <strong>.htpasswd</strong> anywhere you like: you will just need to point to its absolute location in <strong>.htaccess</strong>.  Then go to the directory where you&#8217;re planning to put your<strong> .htpasswd</strong> file. </span></p>
<p><span lang="EN-US">Now we need to have username and password &#8211; that&#8217;s enough. The following command will create your .htpasswd file with login data so you can use it immediately. </span></p>
<p><strong><span lang="EN-US"> htpasswd -bcm .htpasswd user password</span></strong></p>
<p><span lang="EN-US">You can read more about this command at </span><a href="http://httpd.apache.org/docs/2.0/programs/htpasswd.html"><span lang="EN-US">Apache Site</span></a><span lang="EN-US">. But this command will help you to create a password file without any specific knowledge. </span></p>
<p><span lang="EN-US">Please, note that <strong>.htpasswd</strong> is just the file name: you&#8217;re welcome to store your passwords in the files with any file names, but it would be better if it is started with a dot and if this file is stored in the directory that is not accessible from web. </span></p>
<p><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/08/how-to-protect-a-folder-using-htaccess-from-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Custom Error Pages for All User Domains with .htaccess on a Directadmin Server</title>
		<link>http://www.lampdocs.com/blog/2008/06/setting-custom-error-pages-for-all-user-domains-with-htaccess-on-a-directadmin-server/</link>
		<comments>http://www.lampdocs.com/blog/2008/06/setting-custom-error-pages-for-all-user-domains-with-htaccess-on-a-directadmin-server/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 18:40:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Directadmin Tricks]]></category>
		<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[custom error pages directadmin]]></category>
		<category><![CDATA[directadmin custom error code]]></category>
		<category><![CDATA[error pages for all domain directadmin]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=89</guid>
		<description><![CDATA[Sometimes it is useful to use custom error pages on all user domains  (In case of maintenance, new software installation, etc). It&#8217;s a pity you are unable to do it for all user domains in Directadmin, just for a single one. But htaccess comes to help us this time. Go to /home/admin/domains (certainly, replace admin [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is useful to use custom error pages on all user domains  (In case of maintenance, new software installation, etc). It&#8217;s a pity you are unable to do it for all user domains in Directadmin, just for a single one. But htaccess comes to help us this time.</p>
<p>Go to /home/admin/domains (certainly, replace admin with your username) and create a .htaccess file containing the following code:</p>
<p><strong>ErrorDocument 404 http://google.com</strong></p>
<p>This code will be valid for all domains that are owned by this user, so you don&#8217;t need to change your custom error pages one by one.</p>
<p>It&#8217;s a pity Directadmin doesn&#8217;t have any options for bulk domain options, i.e. bulk domain addiction, bulk DNS modification, etc. Bulk error code setting could also be a nice feature for such a panel and hope it will be realized soon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/06/setting-custom-error-pages-for-all-user-domains-with-htaccess-on-a-directadmin-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Deny Directory Listing Using .htaccess</title>
		<link>http://www.lampdocs.com/blog/2008/06/how-to-deny-directory-listing-using-htaccess/</link>
		<comments>http://www.lampdocs.com/blog/2008/06/how-to-deny-directory-listing-using-htaccess/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 16:15:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache Performance]]></category>
		<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[.htaccess and deny directory listing]]></category>
		<category><![CDATA[deny directory listing]]></category>
		<category><![CDATA[deny directory listing apache]]></category>
		<category><![CDATA[deny file listing htaccess]]></category>
		<category><![CDATA[directory listing apache]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=84</guid>
		<description><![CDATA[Often when you&#8217;re using shared hosting, there are some problems with directory listing. Server administrators should avoid this as this represents a security hole. But what to do if you don&#8217;t have access to httpd conf and need to prevent directory listing? What to do if you have something like this: A simple string in [...]]]></description>
			<content:encoded><![CDATA[<p>Often when you&#8217;re using shared hosting, there are some problems with directory listing. Server administrators should avoid this as this represents a security hole. But what to do if you don&#8217;t have access to httpd conf and need to prevent directory listing? What to do if you have something like this:</p>
<p><a href="http://www.lampdocs.com/blog/wp-content/uploads/2008/06/directory_list.jpg"><img class="alignnone size-medium wp-image-85" title="directory listing how to deny" src="http://www.lampdocs.com/blog/wp-content/uploads/2008/06/directory_list-300x279.jpg" alt="" width="300" height="279" /></a></p>
<p>A simple string in .htaccess file will save you. Here it is:</p>
<p><strong>IndexIgnore *</strong></p>
<p>In some cases the following string will also work:</p>
<p><strong>Options -Indexes</strong></p>
<p>One of these two solutions will lead you to showing 403 error to the user that tries to look what files are located in your directory. But let me repeat &#8211; this is a security hole and you should notify your system administrator about this issue. This is an emergency solution&#8230;</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.lampdocs.com/blog/2008/05/disable-directory-listing-without-slash-apache-config/" title="Disable Directory Listing Without Slash &#8211; Apache Config (May 2, 2008)">Disable Directory Listing Without Slash &#8211; Apache Config</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/06/how-to-deny-directory-listing-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deny Access to All IPs Except Yours .htaccess Solution</title>
		<link>http://www.lampdocs.com/blog/2008/05/deny-access-to-all-ips-except-yours-htaccess-solution/</link>
		<comments>http://www.lampdocs.com/blog/2008/05/deny-access-to-all-ips-except-yours-htaccess-solution/#comments</comments>
		<pubDate>Thu, 01 May 2008 06:08:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[htaccess deny from all]]></category>
		<category><![CDATA[htaccess deny IP]]></category>
		<category><![CDATA[htaccess under construction]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=38</guid>
		<description><![CDATA[Sometimes you need to perform any specific tasks that require nobody accesses the page while it is being edited. There may be some tests, database update or anything else. So your task is to deny access to your site from all ips except yours. Note, that all your site visitors should not be redirected anywhere, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to perform any specific tasks that require nobody accesses the page while it is being edited. There may be some tests, database update or anything else. So your task is to deny access to your site from all ips except yours. Note, that all your site visitors should not be redirected anywhere, but should be shown a message that your site will be available soon, or something in this way. You need to allow access from your IP only and others should be redirected to a specific page of your site. I am going to show you 2 .htaccess solutions:</p>
<p>RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{HTTP_HOST} ^site\.ru<br />
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111<br />
RewriteRule ^(.*)$ <a rel="nofollow" href="http://www.nulled.ws/redirector.php?url=http%3A%2F%2Fsite.ru%2Fsite-temp-down.html" target="_blank">http://site.com/under_construction.html</a> [L]</p>
<p>The second one is to use 403 page of your site:<br />
Order deny,allow<br />
Allow from 127.0.0.1 111.111.111.111<br />
Deny from all</p>
<p>ErrorDocument 403 /reconstruction.html</p>
<p>You need to replace 111.111.111.111 with your IP and everything should be solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/05/deny-access-to-all-ips-except-yours-htaccess-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache: How To Deny Access To Certain File Types</title>
		<link>http://www.lampdocs.com/blog/2008/04/apache-how-to-deny-access-to-certain-file-types/</link>
		<comments>http://www.lampdocs.com/blog/2008/04/apache-how-to-deny-access-to-certain-file-types/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 06:22:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache Performance]]></category>
		<category><![CDATA[htaccess Solutions]]></category>
		<category><![CDATA[how to deny access to certain file types]]></category>

		<guid isPermaLink="false">http://www.lampdocs.com/blog/?p=25</guid>
		<description><![CDATA[Sometimes we need to close access to cerain file types. We often deny directory listings and think that&#8217;s enough. But even if the files will not appear in directory indexes this will not imply that access to the files will be denied and if a remote user knows the exact location of the file, he [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes we need to close access to cerain file types. We often deny directory listings and think that&#8217;s enough.  But even if the files will not appear in directory indexes this will not imply that access to the files will be denied and if a remote user knows the exact location of the file, he will still be able to access the file from a browser. How can someone find out about the location of the private file? Well this doesn’t really matter too much, but he might see paths, or files, shown in a warning messages, or anything else.<br />
So if there are ’special files’ that you want to not be served in any case to remote users then you will have to deny access to them.</p>
<p>In order to achieve this we will be using the standard apache module mod_access that will allow us to define rules for various contexts (&lt;Directory&gt;, &lt;Files&gt;, and &lt;Location&gt; sections). In this case we will be interested in the &lt;Files&gt; section.<br />
Allow/Deny Directive in &lt;Files&gt;</p>
<p>Your apache might contain in the default configuration (or at least it would be nice) a configuration similar to the following one that will deny access from the browser to .htaccess files:</p>
<p><code>&lt;Files ~ "^\.htaccess"&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/Files&gt;</code></p>
<p>Let’s see how we can deny access to several files; let’s consider that we want to deny access to all files with the extension .inc (includes in our php application). In order to achieve this we will add the following configuration lines in the appropriate context (either global config, or vhost/directory, or from .htaccess):<br />
<code><br />
&lt;Files ~ "\.inc$"&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/Files&gt;<br />
</code><br />
Similar to this we can deny access to whatever files we might need. This does not refer to folder protection, it works just for defined file types. You can protect a directory from being viewed using Directadmin Ditectory Password protection page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lampdocs.com/blog/2008/04/apache-how-to-deny-access-to-certain-file-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
