Jump to content

Search the Community

Showing results for tags 'Redirect'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 48 results

  1. Hello, for quite a while I found it quite annoying that when you edit a page from a lister view and then save+exit you will end up at the page tree and not at the lister view where you came from. I haven't found a setting that lets you return to the lister view. I wrote a little hook that does just that for a project where I am using Lister Pro. The lister is called Events and has a fixed url. It lists only one type of pages with template event. Here's the working hook code that I placed in admin.php: // redirect to events list on save+exit wire()->addHookBefore('ProcessPageEdit::processSaveRedirect', function($event) { $id = (int) $this->input->post('id'); $page = wire('pages')->get($id); if($this->input->post('submit_save') == 'exit' && $page->template->name == 'event' && wire('user')->hasRole('member')) $this->session->redirect(wire('config')->urls->admin . 'events/'); }); Now I would like to make this more generic so that it works for any lister. How can I get the referring URL (other than from $_SERVER['HTTP_REFERER']) to use it instead of the hardcoded URL I have now in the redirect? And is there any way that I can access properties of the instance of ProcessPageEdit that called processSaveRedirect? The $event->object is the processSaveRedirect method and $this is ProcessWire. How can I access properties of ProcessPageEdit? E.g. $id or $page. ATM I am getting the page id from the $input->post. Obviously I am not a savvy PHP OOP dev and have no idea how to do such things in a proper way EDIT: I know I could open pages from the lister view in a modal to avoid having to redirect. But I don't want to use that option. $_SERVER['HTTP_REFERER'] gives me the URL of the page that I edited and not the URL of the lister.
  2. Good day. Short Version: How can I redirect a template that doesn't have a .php file back to its parent? ------- Detailed Version Question: I have a a template that doesn't have a php file. The template is basically used to hold other templates. For instance, I have a php file called business-directory.php which display's all (child) businesses from the business categories template. Business Directory business-categories (2) ABC Fence Roper Cattle So, if a user goes to /home/business-directory/ it fetches and displays all children from business categories. However, if someone manually types in /home/business-directory/business-categories/ I want to redirect them back to the parent 'business-directory'. (without having to create a .php file called business-categories.php) I was looking at the template settings for 'business-categories' and came up with what you see in the photo. I basically toggled off View Pages for guests to get the URL options, saved it, then toggled back on View Pages for guest (everyone) and it still retains the URL for the redirect. This below seems to work as long as the page is not moved. I tried putting in $page->parent->url;, but got an error that this was a 'Forged Request'. Any suggestions?
  3. Hello, I need to redirect the old paths after migration to a multisite PW installation. There are 3 domains and small differences between paths i.e. old path: domain-2/?text new path: domain-2/text or domain-2/new_text I try it via .htaccess (in the root direction) with an 301 redirect: redirect 301 domain/old_path domain/new_path -> generates an 500 server error What is wrong? How to do that?
  4. Hi there, actually I found a solution but I'd like to know, whether there's a better way. PW is installed in a subdirectory /pw/. In root there's the site in pure HTML, which I set up first and then integrated it into PW. Images, CSS and other resources are in subdirectories on the same level as /pw/. Now, as the PW version runs flawlessly, I redirected the domain to the subdirectory, where PW took over. I did this with the provider admin panel, not with some .htaccess in the root directory. The result was, that, with the server replacing all "domain.tld" strings with "domain.tld/pw", all queries to resources ran not to "domain.tld/img/..." but to "domain.tld/pw/img/..." , which gave of course the 500 error. The solution was, to simply copy all resource directories, like /styles, /js, /images &c. into /pw. The more experienced may have a better card in their sleeves? I am interested.
  5. Hi there, Goal: user profile visible as: http://mysite.com/username So far visible as: http://mysite.com/user.show?user=username 404 template: <?php $username=$input->get->user;?> <? $hello = $users->get($username); echo $hello->name; echo $hello->id;?> I have added this to .htacces RewriteRule ^[A-Za-z-]+/([A-Za-z0-9-]+)/?$ user.show?user=$1 [NC,L] But it doesn't work. It would be much better to not use 404 template.. Any idea how to get this working? edit: I've added page and template "show" with the above code. I have added this code to header.inc <?/** * This hook modifies the default behavior of the Page::path function (and thereby Page::url) * * The primary purpose is to redefine blog posts to be accessed at a URL off the root level * rather than under /posts/ (where they actually live). * */ wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'show') { $event->replace = true; $event->return = "/$page->name/"; } });?> Seems like I'm missing something as it doesn't work for me. And I can't access users path anyway as it's restricted, right?
  6. Is there something wrong with the following redirect syntax ? <?php $session->redirect($page->get(1184)->url); ?> I've used this (below) to successfully redirect to a child URL so thought I was on the right track. <?php $session->redirect($page->child->url); ?>
  7. Hi there, I think it is a quite simple Question. My Page has 2 sections, and can be accessed by 2 Domains. It should automatically redirect to a section by domain How can I achieve the following setup:? domaina.com -> domaina.com/asection domainb.com -> domainb.com/bsection Thanks for any help Joerg
  8. hi guys, I have a project which is about to get live and it has two languages: default: englisch second: german Unfortunatelly translation of content will not be done in English for the launch. How can I simply redirect EVERY person that is not logged in to the German version of a page? Once everything has been translated I will delete the redirect and everything should be fine. It would be great to have a redirect only for not logged in users so the editor can check how the site looks like when adding the translations. Any idea? thanks Sascha
  9. I moved an old site to processwire and want to redirect the old URLs with php-filenames to the new folders via .htaccess to match the new structure. I tried: RedirectMatch 301 /filename.php http://example.com/filename/ The Browser end up like this: http://example.com/filename/?it=filename.php Its interfering with that Processwire .htaccess rule # ----------------------------------------------------------------------------------------------- # Pass control to ProcessWire if all the above directives allow us to this point. # For regular VirtualHosts (most installs) # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] If i comment that out the redirect in the URL is ok, but every Klick on a websitelink is showing the homepage. Any idea how i can fix this? Thanks Andreas
  10. Hello, I've tried to search the forum for this but so far no luck so I decided to post this in wishlist section. Under the Templates/Permissions, there is an option to redirect the user to a certain URL when he is not permitted to view the page. However, this is a pure text input and it's really difficult in the case where I would like to choose to redirect user to a certain page. The page might have multiple URL (multiple languages) or the url might be changed later by the user so a static URL redirection here is no good. Have a nice day.
  11. This is my original question asking for access control for a template https://processwire.com/talk/topic/8847-redirect-to-a-url-in-the-access-tab-of-a-template/ Eventually, as of Soma suggestion, I implemented access control and redirection in template itself. The problem is after a sucessful login, the $session ->redirect method only destinate to one assigned url (in my case it is the homepage). Reading the api doc, the session redirect provide just a simple url redirection. NO MORE functionality provided. Then I append a GET variable on redirect url a page template required a specific user role privilege <?php if (!$user->isLoggedin()) { /* get current page id for page redirection after a successful login */ $pageId = $page->id; $session->redirect(($pages->get("template=login")->url . "?redirect=" . $pageId)); } /* required user with role registered to view this template */ if ($user->hasRole("registered")) { $page->title; $page->body; } else { $page->body = "Your account do not have enough access privileges to view this page."; } include('./main.php'); login form template <?php $pageID = $_GET["redirect"]; $lang = ($user->language->name == 'default') ? '' : $user->language->name . '/'; if ($user->isLoggedin()) { $session->redirect($config->urls->root . $lang); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; $pageID = $input->post->redirect; $redirectPage = $pages->get($pageID)->url; try { if ($session->login($username, $password)) { if ($redirectPage) $session->redirect($redirectPage); $session->redirect($config->urls->root . $lang); } else { $error = "Wrong username or password. Login failed."; } } catch (Exception $e) { $error = $e->getMessage(); } } $form_title = __("Sign In"); $form_user = __("User"); $form_pass = __("Password"); $form_submit_btn = __("Sign in"); $form_error = __("Login failed"); $page->title = "User Login"; $page->body .= " <div class='container'> <div class='col-md-12'> <div class='login-box'> <div class='panel panel-default'> <div class='panel-heading'> <h3 class='panel-title'><span class='lock-icon'></span><strong>$form_title</strong></h3> </div> <div class='panel-body'> <form role='form' action='./' method='post'> <div class='message-error'>$error</div> <input type='hidden' name='redirect' value=$pageID /> <div class='form-group'> <label for='user'>$form_user</label> <input type='text' name='user' id='user' class='form-control' placeholder=$form_user /> </div> <div class='form-group'> <label for='pass'>$form_pass</label> <input type='password' name='pass' id='pass' class='form-control' placeholder=$form_pass /> </div> <button type='submit' class='btn btn-sm btn-primary'>$form_submit_btn</button> </form> </div> </div> </div> </div> </div> "; include('./main.php'); ?> Retrieve the original url from the GET variable and store in a form hidden field. When a successful login, checking this variable, if null , redirect to homepage or otherwise to that url is it secure to implement in this way ?
  12. Hi all Seems I've bumped into an issue where, if I save a page or update a module, I'm redirected back to the home page (frontend). I was using 2.5.23-dev, and thought that an update to 2.5.27-dev would fix it, but no luck. No errors showing up in any logs either. The following modules are installed on the site: AIOM Diagnostics Map Marker Data Tables Maintenance Mode SEO Modules Manager Jumplinks Upgrades Template Notes Upon inspection, module/download/ is sending a 302 redirect to /. Interestingly, the inspector says that the following form data was sent to module/download/: godownload: Download and Update (0.0.4) which is the text for the button (was trying to upgrade the Upgrades module). I assume that is the problem? Update: This doesn't happen with every page, however. If I save the home page, I get redirected back to the home page. If I save the "certification" page, I get redirected to the home page. If I save the "donate" page, however, then it saves and reloads.
  13. Hi, I have a custom built module that auto-generates a number of pages (translations) on creation of a master page (English version) and saves them as subpages of their respective languages. Home - Articles (English) -- Article title - French -- Articles --- Article title (unpublished) - German -- Articles --- Article title (unpublished) etc The pages that are created are unpublished and I'd like if possible to be able to pull content for the English version until a translated version is published. Sometimes no translated version will be available so the English content is seen as a 'fallback' here. Currently to a logged out user trying to view an unpublished translation page will see a 404. Could there be a a way to override this behaviour? I'd only want it to be limited to the translations, so template or parent specific. Extra info... Every translated version has a pagefield storing the master English version, so that info is available for pulling out into a template or module. Each article and it's translations have the same name but is / a country code, such as /fr/ or /de/ etc Any help much appreciated!
  14. hi, i have a question, which i should be able to work out with htaccess, i just wanted to ask, if there's an easier way using processwire: i set up a new site using processwire with multilang etc. since a lot of stuff changed on the website (contents, hierachy, ...) there's now also a different domain structure. the old structure was: www.example.com/outlet-1 and now it's www.example.com/en/find-us/outlet-1 is there any way i can do a (temporary) 301 redirect, without having to remodel to the whole structure? the main reason for this is, that there are still tons of flyers and other advertising materials with this domain structure (transitionphase should end in <6months) the whole thing comes down to about 4-5 pages -- so nothing really drastic. also if there's no way in doing this with processwire, help with a proper RewriteRule for htaccess would be greatly appreciated. current workaround doesnt really do the trick. thanks so far!
  15. Hello all, I was absent for a while from developing - seems I got rusty in the meantime ... Having weird trouble with trying to redirect a page to its first child. I have the following structure: - /section/ (template A) -- /child 1/ (template B) -- /child 2/ (template B) and so on. Template A has the following conditional: if($page->numChildren) $session->redirect($page->child()->url); However, whenever /section/ is clicked, it redirects to /child 2/ but not to /child 1/. This happens on every section with template A and children. To make this even more weird, the redirect has worked perfectly fine for weeks and the strange behavior occurred today after editing content in the admin. Template A sort settings == none /section/ page sort settings == nothing selected I've tried selector "sort=sort" but it changes nothing (/child 1/ is the oldest page). I've also tried to set child sort order on /section/ to manual-drag-and-drop. Again without success. I'm quite helpless with this and would appreciate any help. Thanks.
  16. Hello everybody! This is my first foray into the world outside Wordpress, and ProcessWire looked like it would be able to do what I want to build without overhead, and at the same time an opportunity to learn. I have no coding skills at all. I am diving head-first into the wall here, so bear that in mind please. I have a few questions on the site I’m working on. I’m using the ‘intermediate edition’ where ‘_main.php’ renders some divs of menus and content conditionally, if the variables are declared in the templates (that are loaded before the _main.php). The home is a column of sub-pages like this: Home Products News About Contact … Under the Products I have several sub-pages with products, which in turn have sub-pages of their own. I’d like to have a click on the Products to automatically link to the first product’s first child-page, so I saw this in another thread: $session->redirect($page->child->url); But when I place it in my Products template, and click on ‘Products’ in the main menu, my browser redirects one level at the time, until it gets to the first child of the first product, but the page is then blank (view source shows that the page is empty). The URL looks correct, and if I turn off the redirect and load the very same URL then the site renderes as expected. So my question is what I’m doing wrong here? Additionally I’d like to ask if there is a way to make a redirect go directly to the first child of the first product-page, instead of going in steps one level at the time? ***** Another question entirely is that I’m using the ‘renderNav’ in ‘_func.php’ to render my menus, and in the sub-menus I get the name of the sub-menu at the top of the menu like this: Products Apples Pears Oranges … How do I remove the ‘Products’ from the top? ***** Thanks! Claus
  17. For best practice best-of-scotland.co.uk redirects to www.best-of-scotland.co.uk and this was done by adding these lines to the core htaccess file: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] However, we also have a mobile site working on a parked domain using this method: index.php has the following lines changed to make sure the site directory is hard coded instead on a variable $config->urls->siteModules = "site/modules/"; $assetsDir = "site/assets"; $config->urls->adminTemplates = is_dir("site/$adminTplDir") ? "site/$adminTplDir/" : "$wireDir/$adminTplDir/"; I copied index.config.php from wire to the root and added these line: function ProcessWireHostSiteConfig() { return array( 'mobile.best-of-scotland.co.uk' => 'site-mobile', 'best-of-scotland.co.uk' => 'site', 'www.best-of-scotland.co.uk' => 'site', ); } The problem is that I can't get the two to work together. If I remove the www redirect from the htaccess file the mobile site works. Adding it in stops it working. Can anyone help here please? Or is there a better method for delivering mobile sites? Thanks Mike
  18. I built best-of-scotland.co.uk on Processwire and have a redirect problem. Tried method 1: If I add the line to the .htaccess file I get a site error. At the bottom or the top of the file I tried adding Redirect 301 /index.php/contact http://best-of-scotland.co.uk/contact/ Tried Method 2: Using the redirect module (http://modules.processwire.com/modules/process-redirects/) does not seem to work at all. For example this page http://www.best-of-scotland.co.uk/index.php/contact was the old page and we are trying to get it to redirect to http://www.best-of-scotland.co.uk/contact. Is there a way to redirect an old site with SEO rewritten URLs to the new site?
  19. Hi all, after a longer time working with processwire without stumbling over any issues, I now have come across one (probably only due to my lack of knowledge of rewrite rules). What I want to do, is redirect mydomain.com/index.php to mydomain.com with a 301. This should also work for all subdomains as well as without any subdomain. How can I do this without messing up the rewrite rules for friendly urls etc. in the .htaccess ? I'm a little afraid to just go and do this by trial and error, as it has to be done on a production site... Any help is appreciated!
  20. Ahoi, pros! Currently I've to create some frontend related user profiles. However I stuck at the routing part. All users are a child of a `users`-page and their url's look like this: http://localhost/projects/ca/users/foo/ ...I've to accomplish a url-structure like the following, so I tried redirect all these request to this: http://localhost/projects/ca/foo/ Using .htaccess doesn't work for me in this case: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /projects/ca/ RewriteRule ^users/(.*)$ $1 </IfModule> Any ideas how to get this to work, maybe without .htaccess?
  21. Hi - I'm finalizing a new ecommerce site, and the old site was around for a really long time, i guess it used coldfusion or something like that. The old URLs look like this: /store_item_detail.cfm?item_ID=20&cart_ID=1027539129526 All of those same products are in the new processwire site, and i imported the item_ID fields, so i have access to those; first i tried creating a new page called store_item_detail.cfm with the idea that i could get the item_ID as a get variable and then redirect to the new page; but since the old system doesn't use trailing slashes, i'm kind of stuck on this one... all i really need to do is get access to that item_ID without PW throwing a 404 and then i can do the redirect... TIA!
  22. I'm building a template for a one page website and have run into a small problem with the admin view page links. Because my site is built with content blocks rather than pages there is no header and footer for each block, only the homepage needs to pull in the header and footer for the site. As a result clicking to view a page in the admin shows the page content but with zero styling. This is obviously not ideal for clients so I'd like to find a better solution. Here's a rough idea of the site structure: Home (header & footer) Page 1 Content Block 1 Content Block 2 Page 2 Content Block 3 etc etc My page's use an anchor # for the url eg #contact so Ideally when the user clicks on the page they'd be redirected to that relevant anchor. I know this might be complicated to achieve so all I really need to do is redirect all pages to the homepage (parent). Any idea how I would go about this?
  23. Hi there. I'm hosting my site on a friend's domain. In Google, when searching my site, it shows up as me.friendsdomain.com. I want it to show up as mydomain.com. Can I change this somehow using htaccess? If so, which parts of the file do I modify? Thanks.
×
×
  • Create New...