Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to remove a category from url?
    primarykey
    data
    text
    <p>Now I have <em>urls</em> such as:</p> <pre><code>mysite.com/category/football mysite.com/category/volleyball mysite.com/category/hockey </code></pre> <p>And it corresponds to the rule:</p> <pre><code>RewriteRule ^category/([^/]*)$ category/index.php?name=$1 [L,QSA] </code></pre> <p>But also I have other pages like: <code>mysite.com/feedback</code> or something...</p> <p>How to remove <code>category</code> from url not affecting other pages?</p> <p>If I'll do the rule like this:</p> <pre><code>RewriteRule ^(.*)$ index.php?category=$1 [L] </code></pre> <p>Every other page will be a category, maybe it must be something like this:</p> <pre><code>RewriteRule ^(football|volleyball|hockey)$ category/index.php?category=$1 [L,QSA] </code></pre> <p>But categories can be different. The admin can add new category or remove|change old.</p> <p><strong>update</strong></p> <p>I did an example in files:</p> <p><strong>feedback/index.php</strong></p> <pre><code> &lt;h1&gt;Feedback&lt;/h1&gt; </code></pre> <p><strong>.htaccess</strong></p> <pre><code>RewriteEngine On RewriteBase / RewriteRule ^/(.*)$ category.php?category=$1 [L,QSA] </code></pre> <p><strong>category.php</strong></p> <pre><code>// controller category echo "This is a Category: &lt;br /&gt;"; if (isset($_GET['category']) and !empty($_GET['category'])) { echo "&lt;b&gt;".$_GET['category']."&lt;/b&gt;"; } </code></pre> <p><strong>index.php</strong></p> <pre><code>&lt;a href="/football"&gt;Football&lt;/a&gt; &lt;a href="/volleyball"&gt;Volleyball&lt;/a&gt; &lt;a href="/hockey"&gt;Hockey&lt;/a&gt; &lt;p&gt; &lt;a href="/feedback"&gt;Feedback&lt;/a&gt; &lt;/p&gt; </code></pre> <p>So u can feel this trouble.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload