Open wesort opened 8 years ago
FYI: Workaround
/content/projects
and name it old-url
Example
<?php
header("Location: http://example.com/projects/new-url", true, 301);
exit();
?>
Where the workaround is lacking
This is not ideal as it's a laborious process to create the extra directories and content files and by this measure somewhat unworkable in the long run compared to a standard list of 301 redirects in a .htaccess
file.
What version of Stacey are you using?
3.0.0 according to line 5 of stacey.inc.php
in the app
directory.
FYI: I picked up this project as a reskin. It was set-up by someone else (who I don't know) a few years ago.
It sounds like you are not using the most recent htaccess file. Or your htaccess file is corrupt. https://github.com/kolber/stacey/blob/master/htaccess
Also chmod 777 app/_cache
I am assuming the "example.om" in your example above is a typo and not what is actually being used.
Thanks, but still not resolved.
This is after replacing my .htaccess
and running chmod 777 app/_cache
(and even ran chmod -R 777 app/_cache
to be sure.) And yup, example.om
was a typo when I removed the client url.
Can I ask, do you have 301 redirects working on any other Stacey sites?
I do not have any 301 redirects on any Stacey sites.
I just tested this on one of my Stacey sites and got a 404.
I have not had a need for 301 redirects on any Stacey sites, but, now you have me curious. Please keep us updated on what you come up with.
Well thanks for trying anyway.
As I needed to push content changes live, which included renaming some projects, I have used the workaround mentioned above of php redirects. A little bit laborious as there were 30 or so redirects needed, but used a spreadsheet to concatenate the php snippets. If I was better at bash I'm sure a script could be made easily enough.
Sorry I couldn't be more help.
I am not very good with php but I suspect the problem/answer is in app/stacey.inc.php
at lines 11-13 and 18-20.
if(preg_match('/^\/?(index|app)\/?$/', $_SERVER['REQUEST_URI'])) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ../');
header('HTTP/1.1 301 Moved Permanently');
header('Location:'.$_SERVER['REQUEST_URI'].'/');
return true;
I'm working through some changes on a Stacey site and am wondering how to best handle URL redirects. My use-case is for maintaining legacy URLs for both user convenience and SEO.
Example:
/projects/old-url
should redirect to/projects/new-url
I have the following in the root .htaccess file
redirect 301 /projects/old-url/ http://example.om/projects/new-url/
NB "RewriteEngine on" already, domain changed for client privacyThe
/new-url
page loads as follows:http://example.com/projects/new-url/?/projects/old-url/
http://example.com/projects/new-url/content/1.projects/new-url/image.jpg
Any ideas how to resolve this? Or is this simply how Stacey operates and therefore unavoidable?