I have converted an older php / non template website to use pluse 5.
The old pages all ended in .php e.g. /contact-us.php and new pages using pulse 5 do not e.g now show as /contact
does anyone know of a way to setup a redirect so if old links are used it goes to the new page. I have tried adding in a 301 redirect to the htaccess file but this doesn’t seem to work.
Yep I did try these redirect methods in htaccess but none of these work, they just show the error 404 page. I’ve done plenty of times on non-template pulse websites but not working on this, I am guessing it is because the website won’t load a page that isn’t loaded via the admin.
E.g. if I add the old contact.php file to the root folder it just directs to error 404 page.
I had the same issue with an old Pulse 4 site and ended up redirecting the user to the new page using a PHP via a plug-in.
The code for the plug-in can be found in this GIST. Essentially the PHP looks for a super block with the old page URLs and new URLs in it and simply redirects with a 301 if a match is made. Commented out in the code is also a simple counter so you can open up the block and see how many times the redirection has happened.
To use the redirection plugin copy the redirection.php code to a new file and store it in inc/tags in your Pulse site. Create a new super block and add a new line for each redirection in the format; old-url,new-url,1
The number at the end is just for the redirection counter.
Finally to get the redirection to work add the shortcode for the plug-in on the 404 page for the site; {{redirection}}
Placing the code here is important as Pulse will try and locate the correct page and will automatically drop back to the 404 page before finally redirecting to the correct URL.
Redirecting URLs like this takes a little longer to set up than simply adjusting an htaccess file but it means that clients can set up unique URLs for campaigns and redirect them to standard Pulse pages without having to have me do the dirty work.