Jump to content

Recommended Posts

Hello,

 

If i have link like this

 

site.com/index.php?r=$d

 

then i re-write it to be

 

site.com/$d

 

and made .htaccess file

 

RewriteRule ^(.*)/$ index.php?r=$1

 

why it isn't working, however it works fine only if i add .html

as following

 

site.com/$d.html

and

RewriteRule ^(.*)/.html$ index.php?r=$1

 

so how i can write it without .html at its end

 

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/198380-is-that-command-is-right/
Share on other sites

What is the URI that you are using to test your pattern? I can see a few potential problems depending on the exact URI used, but to be honest I can't understand why any of them would necessarily be fixed by using .html on the end of them. I would probably use a pattern something along the lines of...

 

RewriteRule ^(.*)/?$ /index.php?r=$1

 

The only changes I have really made is to make the trailing slash on the input URI optional and to add in a 'root' base for the rewritten address.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.