Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a link that's currently formatted like this:


I want to it redirect it to:


where خبر is equal to news and عنوان-الخبر is the title of the news page. I want ro do it using .htaccess, and provide a permanent 301 redirect for the old URLs.

Do I need to edit the PHP source at all to accomplish this?

share|improve this question

If it's a one off you just make sure your terminal is in UTF-8 mode, then paste the Arabic into a RedirectMatch as normal.

RedirectMatch permanent ^/news/view/1\.html /خبر/عنوان-الخبر

If you wanted it dynamic (i.e. some database which lets you know the title of 1.html) then yes, that would need some PHP.

But if you are saying that 1.html is actually the correct URL, and you just want to change the text that appears in the browser address bar, I don't think that can be done

share|improve this answer

I don't know if you have to edit the PHP source, I suppose not.

I'd try do that with mod_rewrite:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^news/view/1\.html$ /خبر/عنوان-الخبر [R=301,L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.