mr-fan

German htaccess question "Umlaut" domains

Recommended Posts

Like title says i've some domains with umlauts öäüß and i'd like to redirect them to the non umlaut version

example:

http://my-domän.de to http://my-domaein.de

i've somethings like this in my htacess:

##redirect umlautdomain (not my domain)
RewriteCond %{HTTP_HOST} ^xn--mhldorf-nsb.d$ [NC]
RewriteRule ^(.*)$ http://muehldorf.de//$1 [R=301,L]

in my config.php i only have muehldorf.de in my hosts list...

is there something that i've misunderstood? so far it doesn't work....but may the htaccess rules take some time to exicute...i tried since about an hour some different rules.

regards mr-fan

Share this post


Link to post
Share on other sites

If the two domains point to the same server and document root, then you should probably just do a wildcard redirect.

Or, even better, make it redirect if the non-IDN is not being accessed (seeing as it's the only domain in your hosts array):

RewriteCond %{HTTP_HOST} !muehldorf\.de$ [NC]
RewriteRule ^ http://muehldorf.de%{REQUEST_URI} [R=302,L]

I'd recommend that you make this one of the first condition/rule sets, just under RewriteEngine On.

  • Like 1

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Peter Knight
      I have a single Processwire install with two domains pointing to it.
      There's
      in-progress.com which is the "proper domain" and won't be live for a few months mini-project.com which needs to go live immediately but just point to a sub-page Is there a way with .htaccess to know when the site is being accessed through mini-project.com, keep that address is the browser bar and redirect to mini-project.com/project-home/
      To give a little context, a part of the in-progress needs to be accessible immediately and we've registered that temporary mini-project.com and pointed it at the same site.
      The key here is to only do that redirect when mini-project.com is the source request. Otherwise I guess I'd use Jumplinks etc
       
       
    • By Marc
      I am trying to make a simple wiredata module that lets me select a page I want all visitors to be redirected to. I have this working in ready.php but then I decided on putting it in a module and I can't get it to work. Here's the relevant bits:
      public function ready() { $this->addHookBefore('Page::render', $this, 'redirectUsers'); } public function redirectUsers(HookEvent $e) { $page = $e->object; // The page we want to redirect to. $redirect = $e->pages->get($this->redirectPage); if ($page->id == $redirect->id) return; // Prevent infinite loop. if (!$e->user->isLoggedin()) { $e->session->redirect($redirect, false); // 'false' indicates 302 temp redirect. } } I left some checks out for simplification. Whenever I'm not on the page that I want to redirect to, an infinite redirect loop starts. Could anybody explain why that is?
    • By Barry
      I'm trying to direct all pages from their www and http versions to their non www https versions but I'm experiencing some really strange redirecting behaviour instead.
      When I uncomment the http to https lines in the htaccess, I get a too many redirects error on my site I thought that Processwire by default redirected from www to non www? When I apply the following line after the Processwire directives
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] The redirecting seems to work fine but for some reason many of the pages redirect to the homepage.
      I don't know if its a factor but I have jumplinks and multi-language installed and running.
      I've removed all custom rules from the htaccess just so that people see the pages they click on from search engines, but I'm hoping this can be resolves quick. Ideas?
    • By louisstephens
      I hope this is the correct place to post this. I currently am building a "dashboard" that displays some stats etc, but also handles login/logout with a form. Currently, when a user uses the form on the homepage, they redirected (if the credentials are correct) to the backend of processwire.
      However, I was hoping to direct the user back to the dashboard and display an alert (for now until I get a library to handle this). I got it somewhat working if I dont redirect the user. However, if I refresh the page, the alert still "pops up". Does anyone know of a way to redirect to the home page, but then display an alert?
      My Code to login:
      <?php if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($dash); } } ?>