DingDong Posted July 13, 2010 Share Posted July 13, 2010 I am uable to pass query string variables through pretty URL in my test site which has the ip with tilda username URL (example: http://00.00.00.000/~sitename/testpage/$id). Can it be due to server settings, or the tilda in the URL? Execution gives me a 404 error. The url is displayed on the page as <a href='http://00.00.00.000/~sitename/testpage/$id'>".$title."</a> The htaccess file is: <IfModule mod_rewrite.c> Options +Indexes Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d # RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule ^testitemnews/(.*)\$ test.php?id=$1 [QSA,L] </IfModule> I also tried the rewrite rule with # RewriteRule ^http://00.00.00.000/~sitename/testitemnews/(.*)\$ http://00.00.00.000/~sitename/testpage.php&id=$1 [QSA,L] Why is the page not displaying? I am really in a bad situation. Please help. The page displays with original url if it is not made pretty with htaccess code. What server setting should be changed or is it the code? The php server is 5.9 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/ Share on other sites More sharing options...
dose Posted July 13, 2010 Share Posted July 13, 2010 RewriteRule ^testitemnews\/(.*) test.php?id=$1 [QSA,L] Should work, im not a expert with htaccess but i have similar entries in my htaccess. Heres one of mine. Which comes up as domain.com/generators/somegame RewriteRule ^generators\/(.*) gen.php?game=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/#findComment-1085325 Share on other sites More sharing options...
DingDong Posted July 13, 2010 Author Share Posted July 13, 2010 I figured that if I give .php extension to the file name, the htaccess, the my code and the code you sent works. But my problem remains as I am looking for clean url without .php. eg: <a href='http://00.00.00.000/~sitename/test.php/$id'>".$title."</a> The htaccess file is: <IfModule mod_rewrite.c> Options +Indexes Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d # RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule ^test.php/(.*)\$ test.php?id=$1 [QSA,L] </IfModule> Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/#findComment-1085338 Share on other sites More sharing options...
dose Posted July 13, 2010 Share Posted July 13, 2010 I figured that if I give .php extension to the file name, the htaccess, the my code and the code you sent works. But my problem remains as I am looking for clean url without .php. eg: <a href='http://00.00.00.000/~sitename/test.php/$id'>".$title."</a> The htaccess file is: <IfModule mod_rewrite.c> Options +Indexes Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d # RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule ^test.php/(.*)\$ test.php?id=$1 [QSA,L] </IfModule> ^test.php/(.*)\$ is what you turn test.php into.. so why would you add .php to that part if you dont want it in the url.. im kinda lost now lol Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/#findComment-1085343 Share on other sites More sharing options...
DingDong Posted July 13, 2010 Author Share Posted July 13, 2010 Yes, you're right. My goal is to have clean url with no php extension. I am migrating to a new server and the new server is not recognising the previous htaccess code I have been using(posted in my first posting) which did display clean url. But now, I am unable to figure out why the server does not recognize the masking of test.php. I am not getting help from my hosting company as they it is a coding issue. The server is on php 5.9. Is there any insight on why server does not recognize the htaccess masking without the .php extension? Or am I coding wrong? Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/#findComment-1085349 Share on other sites More sharing options...
dose Posted July 13, 2010 Share Posted July 13, 2010 if your original code worked you shouldnt have to change it.. i would guess its a setting your host has disabled or something Quote Link to comment https://forums.phpfreaks.com/topic/207600-htaccess-problem-pretty-url-with-~username-and-ip-please-help/#findComment-1085351 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.