Search the Community
Showing results for tags 'rewrite'.
-
Hello everyone, hopefully this is the right place to ask and is not a duplicate question. I'm pretty new to processwire, so... if this question is kind of funny for some of you, you're welcome ? I have the following issue and can't find anything understandable about it. Maybe I'm searching the wrong way, but anyways.. here is my question: How is it possible to rewrite the URLs, that I'll get a *.php ending? Example: https://www.mysite.de/urlsegment/ -> https://www.mysite.de/urlsegment.php https://www.mysite.de/urlsegment/urlsegment/ -> https://www.mysite.de/urlsegment/urlsegment.php Because I've read a lot about "Why do you wanna do this or have that?" – here my answer for that in advance: I've built a processwire installation inside or around an existing website. Therefore, we want to keep the existing *.php Google entries. Sure, we could redirect via 301 Redirect, but would prefer to keep the *.php ending. If you have further questions, please do not hesitate to ask. Thank you in advance for your help. – Best regards ce90
-
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?
-
I'd be grateful if anyone has a solution to the following issue. By default Processwire builds its urls like this: www.domain.com/pagenameparent/pagenamechild On the surface this seems excellent for SEO but has been causing us a few issues. Let me explain. In a responsive environment a drop-down menu like below must activate on touch/click. And, the top level is NOT a page. (Obvious, when you consider that you cannot 'click' to this link with your finger). See this example. Below you will see that ABOUT US is a top level menu with children. Is this arrangement on a Bootstrap menu ABOUT US cannot be clicked as it could be on a tablet. Therefore, ABOUT US is not a page. Let's take the first child as an example. WHO WE ARE, would have its url structure built by Processwire like this: www.domain.com/about-us/who-we-are/ 2 problems here: If we create breadcrumb navigation then ABOUT US becomes a link to a page that should not exist. /about-us/ on its own creates issues with SEO. In a complex system trying to exclude these from searches and sitemaps is a a real issue. What would solve the problem is the ability to rewrite the url structure. It would be preferable to write the example url as www.domain.com/who-we-are/ Can this be done without having to change any core code?
-
Hi, I have a problem with the correct redirect-rules. My site-structure is: - continent 1 --- land 1 ----- project 11 ----- project 12 --- land 2 ----- project 21 - continent 2 ... - stuff --- donation form Now I want to use the same donation form in all projects. The relevant project should be preselected in a select field. For this I would like to create a rewrite rule in .htaccess. The url segments for the template are already approved. The url /continent1/land1/project11/donation should be to /stuff/donation/project11/land1/continent1. What is the correct rule? I've tried a concrete example in the redirect module, but I get only a blank page with no error message. Where is my mistake? Please help me. Thanks, Enibas