July 11, 201115 yr Hi everyone, I need help concerning the rewrite! How should look Rewrite Rule for this link> http://my-site.com/like.php?l=10 I want to look like this> http://my-site.com/like/10
July 11, 201115 yr I believe it would be: RewriteEngine on RewriteRule ^like/(.*) /like.php?l=$1 [NC] Let me know if it works Edited July 11, 201115 yr by AlecIsh
July 12, 201115 yr Author I believe it would be: RewriteEngine on RewriteRule ^like/(.*) /like.php?l=$1 [NC] Let me know if it works Thanks for the reply, but this don't work. This isn't a static page, users can publish content and in fact this number behind is number of the post. like.php?l=130 Edited July 12, 201115 yr by e><pert
July 18, 201115 yr Could you try RewriteEngine on RewriteRule ^like/([0-9]+)$ like.php?l=$1 [NC] If this one doesn't work, we'd better tweak it some more. The [0-9] will mean that only numbers are allowed for the "l=" bit.
July 18, 201115 yr Forgot to say obviously you don't need the [NC] at the end if it's numbers only - sorry, forgot to whip that off.
July 21, 201115 yr Try setting a rewrite base. I'll asusme you're using xampp and have your site is accessible locally at http://localhost/mysite In your htaccess file try adding the following on the second line RewriteBase /mysite Ah yes the base always forget about that myself as well. Good call rallport.
July 24, 201115 yr Author Try setting a rewrite base. I'll asusme you're using xampp and have your site is accessible locally at http://localhost/mysite In your htaccess file try adding the following on the second line RewriteBase /mysite I have this site live on the internet and page like.php is in the root folder along with. htaccess so you do not need to use those line, I don't know what was wrong, I contacted support and the operator told me that mod_rewrite is active by default on server...
July 24, 201115 yr This definitely works for me: RewriteEngine On RewriteBase / RewriteRule ^like/([0-9]*)$ /like.php?l=$1 [L] Screenshot of PHP fetching the 'l' variable using $_GET:
Create an account or sign in to comment