Jump to content

RewriteRule not working on all words


emptry

Recommended Posts

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
 
#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]

 

 

Link to comment
Share on other sites

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:

([^/]+)
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.