Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

http://site.com/news/view/1.html

I want to it redirect it to:

http://site.com/خبر/عنوان-الخبر

where خبر is equal to news and عنوان-الخبر is the title of the news page. I want 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
add comment

2 Answers

If its 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
add comment

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

I'd try do that with:

RewriteBase /

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{REQUEST_URI} ^\/news\/view\/1.html$

RewriteRule (.*) http://site.com/خبر/عنوان-الخبر [R=301,L,QSA]

share|improve this answer
add comment

Your Answer

 
discard

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.