Jump to content

Release: Redirects


apeisa

Recommended Posts

Tom: Regarding Legacy Domains, do you think it may come in handy if we were to add per-redirect exceptions? Perhaps you want to keep a URL on your legacy domain, but if its accessed on the new site, you don't want to redirect to legacy. Yes?

Hmm. If the URL on the new site resolved to an actual page, then the redirect shouldn't get triggered — correct?

So if you have:

newsite.com/products/ (actual PW page)

oldsite.com/products/ 

Then you could only get to oldsite.com/products/ by directly accessing that URL.

I think this is the current behavior of the redirects module.

All that said, I might be misunderstanding your question. :D

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

I am just curious about a weird style sheet insertion issue with ProcessRedirects and AIOM I came across. Maybe somebody can shed some light on this.

I upgraded to version 1.0.1 published by renobird. I am also using AIOM and found that when using AIOM in development mode (only then) a style sheet 

/site/modules/ProcessRedirects/ProcessRedirects.css?v=101

is added to the $config->styles array which then fails to load as absolute paths are not [yet] supported by AIOM.

I also saw that ProcessRedirects version 1.0.1 has renamed the style sheet to ProcessRedirects2.css and once I remove ProcessRedirects.css from the /site/modules/ProcessRedirects directory, the style sheet is not added to the array any more.

Is this a known thing? And is this issue the reason why the style sheet was renamed from ProcessRedirects.css to ProcessRedirects2.css?

Link to comment
Share on other sites

  • 1 month later...

I installed ProcessRedirects from the module library into my 2.5.3 install yesterday. This morning, after getting the answer to my .html/.xml question, I tried to set up a few redirects. I'm finding that any Page whose URL ends in .html is getting / tacked onto the end after Page selection, and then the URL is considered invalid and fails to save (though quietly, it seems). I've tried changing the individual pages' URLs after I select the page and save the redirect, but when I go back I get an error message.

In this thread, this appears to have been corrected long ago. My ProcessRedirects config page shows it's versions 1.0.0, and declares it is up to date. I see other versions in this thread, though.

So..

1 - Shouldn't my problem not be an issue even in 1.0.0, and how can I fix it?

2 - Should I update to the latest version in this thread (looks like Dec 2014)? Is it stable for use in live sites?

Thanks!

Link to comment
Share on other sites

Hi all,

I am just curious about a weird style sheet insertion issue with ProcessRedirects and AIOM I came across. Maybe somebody can shed some light on this.

I upgraded to version 1.0.1 published by renobird. I am also using AIOM and found that when using AIOM in development mode (only then) a style sheet 

/site/modules/ProcessRedirects/ProcessRedirects.css?v=101

is added to the $config->styles array which then fails to load as absolute paths are not [yet] supported by AIOM.

I also saw that ProcessRedirects version 1.0.1 has renamed the style sheet to ProcessRedirects2.css and once I remove ProcessRedirects.css from the /site/modules/ProcessRedirects directory, the style sheet is not added to the array any more.

Is this a known thing? And is this issue the reason why the style sheet was renamed from ProcessRedirects.css to ProcessRedirects2.css?

I could explain why you shouldn't use $config->styles array, but soma did a great job already.

Link to comment
Share on other sites

Did you turn off the trailing slashes for those templates?

Yes. I did just notice saving a page generates the message "Saved Page: /markets/industrial-automation.html/" even though I have triple-checked the template and there are no trailing slashes.

Edited to Add: So is there some inherent instinct in PWire to add that trailing slash, beyond what's defined in the Settings of each page and the URL behavior of the Template?

Edited by creativejay
Link to comment
Share on other sites

Yes. I did just notice saving a page generates the message "Saved Page: /markets/industrial-automation.html/" even though I have triple-checked the template and there are no trailing slashes.

Edited to Add: So is there some inherent instinct in PWire to add that trailing slash, beyond what's defined in the Settings of each page and the URL behavior of the Template?

Confirmed - that's happening to me too. I always turn off slashes, but they show in notifications. I haven't looked, but it must be hard-coded into the notification string, whereby it doesn't check to see what the template's setting is.

Edit: Appears I'm wrong. Line 259 of ProcessPageEdit.module (v2.5.20) shows:

$message = sprintf($this->_('Saved Page: %s'), $this->page->path) . $numChanges;

Perhaps $this->page->path is not being updated according to the template setting?

Edited by Mike Anthony
Link to comment
Share on other sites

  • 1 month later...

I seems that module dosn't work for urls (redirect-from) with UTF-8 characters. 

This change (adding "urldecode") in file ProcessRedirect.module fixed my problem:

public function checkRedirects($event) {  
  $url = urldecode($_SERVER['REQUEST_URI']);
  • Like 1
Link to comment
Share on other sites

Thanks renobird,

I tried Jumplinks, but it has his own problems (import save all destinations as URLs, not page ids; it generates some php warnings etc.). 

I've returned to ProcessRedirects because these problems and because I need simple URL mapping.

I found another problem with ProcessRedirects: it does not found hidden or unpublished destination pages.

I've modified below code in order to work with hidden or unpublished pages (I've added "include=all" selector):

	private function _saveRedirect($from, $to, $id = 0) {
		$from = $this->_addUrlSlashes($from);
		$to = $this->sanitizer->url($to);

		// Not external url, if it starts with slash
		if(substr($to, 0, 1) == "/") {
			// if the redirect_to maps to a page, then store it's ID instead
			if(($page = $this->pages->get("$to, include=all")) && $page->id) $to = '^' . $page->id;
		}

Link to comment
Share on other sites

I can see why you would want to return hidden pages, as they are still viewable even if excluded from lists and searches. Not including unpublished pages seems like the desired behavior. Maybe I'm missing something, but why would you want to redirect to an unpublished page? It should return a 404.

Link to comment
Share on other sites

I tried Jumplinks, but it has his own problems (import save all destinations as URLs, not page ids; it generates some php warnings etc.). 

Hi marc1n,

I'm not sure what you mean by that... Where are you importing data from? And what warnings are you getting?

Edit: An import will only save page IDs if you're importing from ProcessRedirects. If you're importing from CSV, then it won't. Perhaps I should add that functionality in? So if a destination URI matches an existing page, we should set it to use the ID instead... Is that what you're referring to?

  • Like 2
Link to comment
Share on other sites

I'm not sure what you mean by that... Where are you importing data from? And what warnings are you getting?

Edit: An import will only save page IDs if you're importing from ProcessRedirects. If you're importing from CSV, then it won't. Perhaps I should add that functionality in? So if a destination URI matches an existing page, we should set it to use the ID instead... Is that what you're referring to?

I was importing from CVS. The lack of this functionality is the reason I returned to ProcessRedirects module. I don't remember text of warnings, sorry. 

Link to comment
Share on other sites

I can see why you would want to return hidden pages, as they are still viewable even if excluded from lists and searches. Not including unpublished pages seems like the desired behavior. Maybe I'm missing something, but why would you want to redirect to an unpublished page? It should return a 404.

My use case is such that I have unpublished pages. I am importing URL mapping from CSV. I want that import matches old URLs with these unpublished pages ID's, because perhaps I will change name of these pages before I will publish them.

Link to comment
Share on other sites

I see that I actually did implement the feature, but it checks by name, which won't always work.

Redirects uses this:

if(($page = $this->pages->get($to)) && $page->id) $to = '^' . $page->id;

Jumplinks uses this:

if (($page = $this->pages->get('name=' . trim($input->destinationUriUrl, '/'))) && $page->id) {
    $input->destinationUriUrl = "page:{$page->id}";
}

I'll fix this asap.

Link to comment
Share on other sites

  • 2 months later...

Did anyone ever experience issues with the Autodetect Language module and redirections?

The Autodetect Language module only kicks in when the user is not reidentified and unfortunately, when this is the case, my redirected urls lead to 404 errors.

Link to comment
Share on other sites

  • 2 months later...

Any time. Side note: That's quite a lot of redirects - perhaps you might want to give Jumplinks (links in signature) a try. It has wildcard support, which will, more than likely, reduce the amount of redirects needed...

But does jump links support 301? We need to pass SEO value to the new pages.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...