How to check if REQUEST_URI is not empty in apache RewriteCond httpd.conf?
<p>In <a href="https://stackoverflow.com/questions/5684940/problem-detecting-empty-request-uri-with-apache-mod-rewrite">Problem detecting empty REQUEST_URI with Apache mod_rewrite</a> , its mentioned we can use</p>

<pre><code>RewriteCond %{REQUEST_URI} ^.$
</code></pre>

<p>or</p>

<pre><code>RewriteCond %{REQUEST_URI} "^/$"
</code></pre>

<p>I need to check if its not empty, then redirect it to an empty one(ignore all the string after HTTP_HOST).</p>

<p>I tried </p>

<pre><code>RewriteCond %{REQUEST_URI} !"^/$"
RewriteRule .*  http://%{HTTP_HOST} [L,R=301]
</code></pre>

<p>but not work. It just caused an endless loop.</p>

<p>Also I tried <code>RewriteCond %{REQUEST_URI} !^/$</code> also <code>RewriteCond %{REQUEST_URI} !^\/$</code> also <code>RewriteCond %{REQUEST_URI} "!^/$"</code> also <code>RewriteCond %{REQUEST_URI} "!^\/$"</code></p>