Forum
Posts not showing with clean urls
Im trying to create clean urls on a live server
.htaccess is in site root:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L]
</IfModule>
and blog post page path is set to /blog/{postSlug}
blog home page works fine but blog post page is blank. The url is clean and looks exactly right, but the page is blank. Its only ok if I put 'post.php?s=' back into the post page path.
And while I'm at it, how can I change the name of the blog so that it doesn't say 'blog' in the url, but shows a different name instead?
You can change the blog folder to anything you like, those are just examples.
If you are getting a "blank page" then you have a PHP error so you would need to look in the error log to see what the actual error is.
https://solutions.grabaperch.com/development/why-am-i-getting-a-blank-page
I'm a bit stuck here. All php errors/warnings in the error log only relate to some errors from a few days ago - nothing relating to today. There is no html being output onto the post page. Just a 404 error message.
File permissions are all set correctly (0644). If I pput back the 'post.php?s=' it works fine, but without the clean url.
You said earlier you were getting a blank page, if you are getting a 404 then that is a straightforward page not found. Your rewrite rule is incorrect in some way for the actual location of your page.
You haven't posted your Diagnostics Report so I don't know whether that rule would match the location or not.
OK I discovered my .htaccess had an rtf extension!
Now I cant work out how to change the name of the blog - Ive changed the name of the blog folder and replaced 'Blog' in htaccess with the new name, and the Blog post page path too, but I'm getting 404 again
Is the page at the location you expect, disregarding any rewrite rules.
Can you now go to: /blockchain-bugle/ and see your blog listing page?
And /blockchain-bugle/post.php?s=a-valid-slug and see a detail page?
Is so then you have an error in your htaccess file, if not then your blog is not at the location specified in settings.
fixed. Thank you very much