Jump to content

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
https://forums.phpfreaks.com/topic/303593-rewriterule-not-working-on-all-words/
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:

([^/]+)

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.

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.

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?

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.