emptry Posted April 1, 2017 Share Posted April 1, 2017 Hello Freaks! I have som problems with a rewrite rule, hope u can help me. I can visit: https://dagenshug.dk/produkter/Begge https://dagenshug.dk/produkter/Him https://dagenshug.dk/produkter/Her even this! https://dagenshug.dk/produkter/asdasdasdasd But if i want to visist https://dagenshug.dk/produkter/Ham OR https://dagenshug.dk/produkter/Hende Then i dont work, and i'll be redriected to 404 :S .. How come ? - It is the same code i am using.. Options +Indexes +FollowSymLinks -MultiViews RewriteEngine On #SSL REDIRECT RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} #404 REDIRECT ErrorDocument 404 https://dagenshug.dk/404/ RewriteCond %{REQUEST_URI} ^/404/$ RewriteRule ^(.*)$ index.php?page=404.php [L] #SEO FRIENDLY CODES RewriteRule ^home index.php [NC,L] RewriteRule ^kontakt index.php?page=contact.php [NC,L] RewriteRule ^gevinst index.php?page=campaign.php [NC,L] RewriteRule ^tak-for-handlen index.php?page=checkout-finish.php [NC,L] RewriteRule ^endnu-engang-tillykke index.php?page=campaign-finish.php [NC,L] RewriteRule ^gevinst index.php?page=campaign.php [NC,L] RewriteRule ^Dagenshug index.php?page=dagenshug.php [NC,L] RewriteRule ^Kundeservice/([0-9a-zA-Z]+) index.php?page=customerservice.php#$1 [NC,L] RewriteRule ^Kundeservice index.php?page=customerservice.php [NC,L] RewriteRule ^Om-dagenshug index.php?page=about.php [NC,L] RewriteRule ^kurv/([0-9a-åA-Å_-]+)/([0-9a-åA-Å_-]+) index.php?page=cart-controller.php&product_number=$1&size=$2 [NC,L] RewriteRule ^kurv/([0-9a-åA-Å_-]+) index.php?page=cart-controller.php&product_number=$1 [NC,L] RewriteRule ^kurv index.php?page=cart.php [NC,L] RewriteRule ^produkter/([0-9a-åA-Å_-]+)/([0-9a-åA-Å_-]+) index.php?page=category.php&category_sex=$1&category_name=$2 RewriteRule ^produkter/([0-9a-åA-Å_-]+) index.php?page=category.php&category_sex=$1 [NC,L] RewriteRule ^produkt/([0-9a-åA-Å_-]+) index.php?page=product.php&product_url_link=$1 [NC,L] RewriteRule ^kassen opc-checkout.php [NC,L] RewriteRule ^mail/ mail-order-confirm.php [NC,L] RewriteRule ^nyheder index.php?page=blog.php [NC,L] Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/ Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 a-åA-ÅYou can't do that. mod_rewrite [probably] only works with individual ASCII bytes so a-å and A-Å will not work the way you think they will. The best thing to do would probably be to loosen the restriction and let your PHP handle it from there: ([^/]+) Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544899 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 I just think it is wierd that some of them is working and others are not... what do you mean by letting php handle it ? Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544907 Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 I just think it is wierd that some of them is working and others are not...It's to do with the bytes involved. Not characters. what do you mean by letting php handle it ?Your PHP code is already be able to deal with invalid categories (at least it should have been able to) so loosening the regex means that some of the categories the RewriteRule could have rejected will instead be rejected by your PHP code. Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544909 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 .. like that .. yes ..But try hit the link below ..https://dagenshug.dk/produkter/asd and then hit https://dagenshug.dk/produkter/Ham or https://dagenshug.dk/produkter/Hende .... Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544911 Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 https://dagenshug.dk/produkter/Hende https://dagenshug.dk/index.php?page=category.php&category_sex=Hende Those two look the same to me, which means the URL rewriting is working. If your site isn't showing what you want then that's a different problem. Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544912 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 The non friendly url is working fine .. but ... I am redirected to 404 on this one: https://dagenshug.dk/produkter/Hende Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544913 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 I just tried it right now.. again .... Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544914 Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 I don't know what you're doing but I get a normal page - at least as far as I can tell. You say "redirected". Does the URL change too? Your browser may be remembering the redirect from before. Close and restart? Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544916 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 Yes the url redirect too https://dagenshug.dk/404 That's my landing page when i hit https://dagenshug.dk/produkter/Ham I have tryed close and start broswer again.. delete cookies.. CTRL+F5 ... Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544920 Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 Then apparently you and I are looking at different servers. Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544921 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 That is so wierd! Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544922 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 I just visit the site with a different browser.. and ... NO PROBLEMO! ! WHAT ! So i think i need to empty the cache in Chrome ? ... but, then hit CTRL+F5, then it shoudl empty the cache, right ? Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544927 Share on other sites More sharing options...
emptry Posted April 1, 2017 Author Share Posted April 1, 2017 Problem sovled! - Clearing the browser.. totaly! helped .. so now it works Quote Link to comment https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/#findComment-1544930 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.