Forum Moderators: coopster
I am trying to figure out how to replace %20 in my URL strings which are generated in my URLs.
I have read several posts and it seems that I need to change the script in my php pages. I use php and MySQL.
Do I need to insert urldecode? or something else?
I first thought I could use a RewriteCond by it seems to not be the case. Any feedback and help on how to get rid of this %20 and replace it with - in my urls would be fantastic.
Thank you in advance.
But what's your plan for making that url valid? In other words
"my file.php" becomes encoded as "my%20file.php" which you now rename to "my-file.php" which doesn't exist on your server. You can't use mod_rewrite to rewrite "my-file.php" back to "my file.php" because you will then break every link to every file that actually has a hyphen in the name.
What I need to get is not my actual php page but the rest of the url to replace with "-".
for example: my-page.php?category=Interior%20Decorating
would become
my-page.php?category=interior-decorating
Then I would use .htaccess to rewrite the pages if possible.
Is there a simpler way to replace %20 with "-" using RewriteCond for example?
This is no longer a problem. I just worked around it I guess.
However, my htaccess file is not doing anything. First I tried it and got a 500 error. I went into the conf file of apache and activated the mod_rewrite module. Then I was able to view my php pages.
However, the .htaccess file is not doing anything. My urls are still in php in the url browser and nothing changed.
I placed the .htaccess file in localhost/mysite.
Here is my .htaccess file:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)\.html$ /mypage.php?addition2=$1 [L]
I also tried:
Options +FollowSymlinks
RewriteBase /
RewriteEngine On
RewriteRule ^(.*)\.html$ /mypage.php?addition2=$1 [L]
Thank you for the help:)