Jump to content

mod_rewrite and special characters (%)


php_guest

Recommended Posts

I have a site in "exostic" language. For SEO purposes, I have in url special characters. I don't want to change url because than I would loose SEO benefit of having title in url.

 

Example:

www.imedomene.com/ποδόσφαιρο

=>

www.imedomene.com/%CF%80%CE%BF%CE%B4%CF%8C%CF%83%CF%86%CE%B1%CE%B9%CF%81%CE%BF

which is actually

www.imedomene.com/article.php?title=%CF%80%CE%BF%CE%B4%CF%8C%CF%83%CF%86%CE%B1%CE%B9%CF%81%CE%BF

 

I would like to make rewrite_rule ^/?(/anything)$ /article.php?url=$1 [L]

 

The problem is when inside everything is %.

I tried RewriteRule ^/?(.*)$ /article.php?url=$1 [L], I have googled half day and checked hundreds of sites and still didn't find solution. Is even possible without any server configuration (I don't have access as I use sharing hosting) solve this with .htaccess?

 

I hope anybody can help me!

Link to comment
https://forums.phpfreaks.com/topic/213528-mod_rewrite-and-special-characters/
Share on other sites

I tried now to use

RewriteRule ^/?(.*)/([-a-zA-Z_&0-9&,!]+)$ /article.php?url=$1 [L]

www.domainname.com/الشباكيةالمغربية/articleId (articleid as number)

instead of

www.domainname.com/الشباكيةمربية

This is a bit closer and works, but I need then to include article id in url.

 

Than I tried also

www.domainname.com/الشباكيةالمغربية/ (no need to include articleId, just /)

RewriteRule ^/?(.*)/(.*)$ /article.php?url=$1 [L]

which is the nearest solution. This also display a page without error, excepting css (I don't know why). Anyway I am not enough familier to replace second .* with a rule nothing but just /. I hope anybody can help with this.

 

Tnx a lot!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.