.htaccess - Rewrite only working for first use -


on godaddy linux hosting, mod rewrite working, having strange problem. simple code looks this:

options +followsymlinks -multiviews rewriteengine on rewritebase /  ## clean urls rewriterule ^blog/([^/.]+)/?$ blog.php?title=$1 [l] 

then test went blog.php?title=testing did supposed , rewrote url blog/testing. when went blog.php?title=test or blog.php?title=new did not rewrite url, tried going blog/test , blog/new , gave me 404 error. thought broke. went blog.php?title=testing , worked again. worked first url entered.

also have domain set in folder under root. root example.com site example.com/something godaddy turns something.com.

i want clean urls, still want php able use $_get on querystring, want nice seo url example.com/blog/title

first rule should redirect php file pretty url second rule should internally redirect pretty url old 1 internally not visible user:

options +followsymlinks -multiviews  rewriteengine on rewritebase /  # redirect /blog.php?title=anything /blog/anything rewritecond %{the_request} ^[a-z]{3,}\s/+blog\.php\?title=([^\s&]+)&? [nc] rewriterule ^ /blog/%1? [r=302,l]  # internally forward /blog/anything /blog.php?title=anything rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^blog/([\w-]+)/?$ /blog.php?title=$1 [l] 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -