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
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!

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.