views:

65

answers:

4

RewriteEngine on

RewriteRule bharani $ index.php

in my .htaccess file .

The above small snippet throwing 500 internal Server Error ,

+1  A: 

You may not use whitespaces in your regex. Try to cut the space between "bharani" and "$".

faileN
RewriteEngine onRewriteRule "bharani" and "index.php"No luck for above changes also...
Bharanikumar
+1  A: 

Try

RewriteRule ^/bharani/?$ index.php

The /? means that the / is optional. Just incase people don't put it in.

my present URL Somthing likehttps://www.atnworld.net/fb/index.php?result_id=1996i want to change this Tohttps://www.atnworld.net/fb/index/result_id/1996
Bharanikumar
I've added another answer so it would be easier to read.
A: 

Something like this:

RewriteRule ^index/([a-zA-Z_-]+)/([0-9]+))/?$ index.php?result_id=$2

or

RewriteRule ^index/result_id/([0-9]+))/?$ index.php?result_id=$1
RewriteRule ^([0-9]+)$ index.php?result_id=$1This snippet fixed my prob, but one doublt is my url is like atnworld.net/fb/index/product/result_id/1996 atnworld.net/fb/index/article/result_id/1996 atnworld.net/fb/index/books/result_id/1996 How to make this three diff url , in rewrite
Bharanikumar
Technically we've helped with your problem. So you should post these as other questions. Seems like we are doing all the work for you.
am lack in .htaccess
Bharanikumar
I've added a suggestion. Should help.
+2  A: 
RewriteRule ^index/result_id/([0-9]+)/?$ index.php?result_id=$1


RewriteRule ^index/article/([0-9]+)/?$ articles.php?article_id=$1

RewriteRule ^index/product/([0-9]+)/?$ products.php?productid=$1

Would be the best to do

Since Ids shouldn't start with a zero, I would rather do something like `^index/result_id/([1-9][0-9]*)/?$ index.php?result_id=$1` . In your regexes there is also one closing paranthesis too much.
faileN
So there is. Was a typo. I've got [0-9]+ to simplify longer numbers. Thanks.