Chima Chima - 2 months ago 15
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

http://myurl.com/blog/post.php?s=2016-08-30-test-8

and i'd like it to look like this

http://beecrowned.com/blog/2016-08-30-test-8

I'm currently using this:

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


But it hasn't worked, any ideas?

Answer

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]
Comments