Chima Chima - 1 year ago 88
PHP Question

Rewriting a url on a shared hosting platform (Perch CMS)

I've been working on this all day and haven't found anything that works. my current url is

and i'd like it to look like this

I'm currently using this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L]

But it hasn't worked, any ideas?

Answer Source

try it in root directory,

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/([\w-]+)$ blog/post.php?s=$1 [QSA,L]