4

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

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

I want to it redirect it to:

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

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?

2 Answers 2

2

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

1

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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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