my website page url is mysite/use.php?v=123(it is dummy entry basically it come from another page)
i want to convert my url into mysite.use-123.html. i got a code for this purpose from http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html but problem is that when i paste below code in .htaccess it is not working

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^use-([0-9]+)\.html$ use.php?id=$1

Recommended Answers

Hi,

I think that th rewrite module is not active or not istalled in your server, to verify this do :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^use-([0-9]+)\.html$ use.php?id=$1  [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 
Jump to Post

This code is to put in your htaccess file, and it's to verify if the rewrite module is active or not.

Jump to Post

When I tried http://www.proudlypakistani.com/use-999.html, I got 999 (the id) !
I think that's works very good !

Jump to Post

I tried http://www.proudlypakistani.com/use.php?id=999 and http://www.proudlypakistani.com/use-999.html and I got the same result !
You can see that here (screenshot) :

Jump to Post

But it is usually the other way that we need, when I type http://www.#############.com/product-12.html, the server in reality will execute http://www.#############.com/includes/product.php?id=12, so nobody know the URL containing the php, that's why we dont need the way that you are speaking about.
In fact, the URL rewriting …

Jump to Post

All 17 Replies

Hi,

I think that th rewrite module is not active or not istalled in your server, to verify this do :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^use-([0-9]+)\.html$ use.php?id=$1  [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 http://www.daniweb.com
</IfModule>  

Here, the 1st if will check if the rewrite module exist and active and then do the rewrite and the second one if it's not and then go to daniweb.com.
Then if the module does not exist or not active, you should activate or add it to you apache.

Mr akmozo
your given coding is not working it doesnot show any response

This code is to put in your htaccess file, and it's to verify if the rewrite module is active or not.

i create another code by using your code below code RewriteCond is properply working u can check out but problem is that use.php?id=129 is not working means RewriteRule is not working

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^proudlypakistani\.com$
RewriteRule (.*) http://www.proudlypakistani.com/$1 [R=301,L]
RewriteEngine on
RewriteRule ^use-([0-9]+)\.html$ use.php?id=$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 http://www.daniweb.com
</IfModule> 

MR akmozo rply me soon i am waiting

Sorry i donot understand Mr akmozo plz tell me detail

mr akmozo tell me what is best seo url

ok thanks
Mr akmozo
can u give me ur personal email id

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.