Configure Preview URL's
Hi,
Today I have succesfully set-up my Mailchimp integration and added a sign up for to my list, excellent news! I have also got my URL rewriting working correctly but I'm not understanding what I need to add to the .htaccess file for the following section from the docs and why. I'd greatly appreciate it if you could let me know what I need to add to the file.
Preview URLs
Once URLs are rewritten, draft post preview is achieved by adding /preview to the end of your URL, so remember to add a rule for that. You should rewrite it to add the query string argument preview=all to the URL.
Look forward to hearing from you.
Regards
Rob
You will need something like this in your .htaccess file
.... assuming that your posts are in /blog/
Hi Clive,
Thanks for the quick response. I've added this to the .htaccess file and then when I click preview in the "Admin" for a given blog post I get what looks to be the correct URL in the browser suffixed via /preview but the page as you will see is missing any styling etc...
As I've only just set the blog up this past week this is the first time I've tried to preview a post so am not sure what I'm supposed to see or if perhaps I need to set something else up for preview to work?
https://www.colconquerors.com/blog/2014-11-04-riding-a-guests-perspective/preview
Help appreciated.
Regards
Rob
If you are rewriting URLs you need to link your stylesheets so they are root relative.
I think I understand but why does the post work when it's not in preview but when I preview it it's un-styled?
Can you given me an example of what you mean also?
Help appreciated.
This is how my stylesheets currently look so not sure what would need changing?
Thanks Drew, I've made those changes but guess I have to change all references within the stylesheet to be as such as well?
No, within a stylesheet any
url()
paths are relative to the location of the stylesheet.I've changed all reference now to be root specific.
When I view the post normally like this the layout of the page is good:
https://www.colconquerors.com/blog/2014-11-04-riding-a-guests-perspective
When I try it with /preview on the end like this there are problems with the layout and I also don't see any content when I view the source HTML from within the browser and not sure why this is?
https://www.colconquerors.com/blog/2014-11-04-riding-a-guests-perspective/preview
Hi Drew,
Not sure if you received my last post? I've take a look and it still doesn't make sense to me...
Help hugely appreciated, this could be the final thing before I can actually start to work on some good content :-)
Cheers
Rob
Ok so the layout thing is me I hadn't made the link to /blog/blog.css correctly. Now everything looks correct there's just no content when I add /preview on the end of the post link or click preview from the admin once the post is marked as draft.
Any ideas why the content is missing?
Help appreciated.
Cheers
Rob
What does your .htaccess file look like?
Thanks for helping.... here is mu .htaccess file:
Try switching the rules around, so the more specific rule comes first:
Try putting the preview rule before the post rule
Two perfect answers!!
Clive, Drew - Thanks very much that all looks to be working now.
I'm guessing now that I'm using these URL's that each of my blog pages I use must always have root paths specified so as at now (index.php, post.php & archive.php)?
Cheers
Rob
You should always do that anyway.
Ok Drew thanks for the tip...
On the same issue I've come across another issue...
I've noticed that when a blog post link is cut and past and has a trailing "/" at the end like the following example when you then are directed to the blog post the categories on the sidebar do not work, rather take me to my page not found page.
The categories don't work for this link:
https://www.colconquerors.com/blog/2014-11-04-a-change-of-scenery-this-winter/
But when like this are as before the changes to the new style URL's. This is important because when shared via the social media link items the link has the trailing "/"
Help appreciated.
Cheers
Rob
Hi Drew,
I think I know the problem but I can't seem to make the change to correct it. WHen I look at the links in the sidebar they go to https://www.colconquerors.com/archive.php?cat=training when in fact this must now be as follows I think. Problem is I made the change below in my category.html and category_link.html file and the links in the side bar still say the non /blog version.
What am I doing wrong?
Problem fixed, I just opened a blog post and saved it and things switched over.
Cheers
Rob