Note that there are some explanatory texts on larger screens.

plurals
  1. PORewrite a dynamic url after extension removed
    primarykey
    data
    text
    <p>I've been working on my HTAccess for a couple days now, and I've hit a dead end.</p> <p>I've rewritten and redirected the files to be extensionless, now I need to rewrite the url to be SEO Friendly.</p> <p>Previously, the URL was: <code>http://www.example.com/member.php?playername=encodedName</code> <br> I removed the extension: <code>http://www.example.com/member?playername=encodedName</code> <br> I can't quite get it to: <code>http://www.example.com/member/encodedName</code></p> <p>Here's what I've gotten so far:</p> <blockquote> <h3>Code trying to redirect to SEO Friendly URL. Does NOT work. <br></h3> </blockquote> <pre><code> RewriteRule ^member/([^/]*)$ /member.php?playername=$1 [L] RewriteRule ^squad/([^/]*)$ /squad.php?squadname=$1 [L] RewriteRule ^article/([^/]*)$ /article.php?articlename=$1 [L] </code></pre> <blockquote> <h3>Unless directory, remove trailing slash. Works.<br></h3> </blockquote> <pre><code> RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [R=301,L] </code></pre> <blockquote> <h3>Resolve .php file for extensionless php urls. Works.<br></h3> </blockquote> <pre><code> RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [L] </code></pre> <blockquote> <h3>Redirect external .php requests to extensionless url. Works.<br></h3> </blockquote> <pre><code> RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.php([#?][^\ ]*)?\ HTTP/ RewriteRule ^(([^/]+/)*[^.]+)\.php $1 [R=301,L] </code></pre> <p>Does anyone have an idea as to what I am doing wrong? It's probably a very newbie problem that I just haven't encountered yet.</p>
    singulars
    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.
    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