1

I am using php $_GET function to call parameters from the database. And these perameters are usually variable within the url.

E.g. http://localhost:8080/series/dynamics/admin/cleanURL/Apple, where Apple is the variable from the database.

This works fine as long as GET function doesn't encounter a space, however in a real life situation I will have some variable such as "Green Apple" "Red Apple" etc..and URL will like,

http://localhost:8080/series/dynamics/admin/cleanURL/Green%20Apple and in that case I am getting 404 The requested URL was not found on this server error.

What I would like to achieve is to be able to conver whitespace into hyphen or +. I have done it through strreplace or urlencode() however the problem is I am still not able to get rid 404 error.

Just incase if it has anything to do with htaccess below is my code

 Options +MultiViews Rewriteengine on RewriteBase /series/dynamics/admin/cleanURL/ RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{THE_REQUEST} /series/dynamics/admin/cleanURL/(\S*)\s [NC] Rewriterule ^(\w+)/?$ index.php?product=$1 [L,QSA] RewriteRule ^series/dynamics/admin/cleanURL/(.*)$ /$1 [L,NC,R] #rewrite group and subgroup e.g. http://.../value1/value2/ Rewriterule ^([a-zA-Z0-9]+(.*)+)/([^/]+(.*)+)/?$ index.php?product=$1&subgroup=$2 [L,NC,QSA] 
4
  • maybe of some value to you Possible Duplicate Commented Feb 28, 2016 at 3:43
  • That answe doesn't help :( Commented Feb 28, 2016 at 9:21
  • 1
    a better question is why are you using folder structures that have whitespace? I'd just change the name of the files to be something like Green_Apple and your problem is fixed. It's better practices. Commented Feb 28, 2016 at 14:53
  • 1
    please put this as an answer I wd accept it if you like. Stupid me....!!! Commented Feb 28, 2016 at 14:59

1 Answer 1

0

a better question is why are you using folder structures that have whitespace? I'd just change the name of the files to be something like Green_Apple and your problem is fixed. It's better practices.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.