Islam Zedan
Islam Zedan

Reputation: 656

Bad Request - Invalid URL PHP Arabic URL

I Have an Arabic site and I put it on tow servers:-

first one :- http://mvis.com.eg/3neza/ar

it works fine put when I uploaded it on its server client server:-unaizh.com

it have a problem with news links when you click on news link in the news bar under the slider it gives you Bad Request - Invalid URL and the URL become a wrong link like this:- http://unaizh.com/en/news/details/��������������-���

Upvotes: 2

Views: 1482

Answers (1)

Bjorn
Bjorn

Reputation: 5362

Bad requests can be thrown at multiple stages

Various parts of your server/app can throw Bad Request responses to the client. To find out how to solve them, you first have to recognize them. In your case, the Bad Request error generated by Code Igniter has a bit of styling and specifically mentions The URI you submitted has disallowed characters.. The Bad Request error generated by the webserver just returns Bad Request - Invalid URL.

Fix bad request errors on the app level

CodeIgniter by default only allows a subset of characters to be in the URI. If you want to change that behavior, look into /system/application/config/config.php. There is a $config['permitted_uri_chars'] variable. By default it'll look like $config['permitted_uri_chars'] = 'a-z 0-9~%.:&_\-'; . You can change it to an empty string. That will solve your problem, but it's not secure.

Related: Codeigniter Redirect -- The URI you submitted has disallowed characters

Fix bad request errors on the server level

You have to find out what triggers the error. Consult your error log, and if it does not return anything useful, turn on debugging. First guesses for this error could be the URL being too long or that the server has to be configured to accept (certain) multibyte characters. As this issue is no longer related to programming but to configuring a web server, further advice should be sought at ServerFault.

Upvotes: 1

Related Questions