Hide .php extension with url rewriting using .htaccess
- Wednesday, February 13, 2008, 12:12
- htaccess, php, tips and technique, tutorial
- 119 comments
Last time I’ve written an article about hiding php file extension where I’ve showed you how you can use .html or .asp extension of file instead of .php extension. But there was one flaw in that technique you have had to change the file extension explicitly but in this post I’m going to show you how to rewrite the URL instead of renaming the file extension Using this technique you will see product.html in the address bar of the browser but the actual file name remains product.php and you don’t need to rename the file extension. Furthermore you can rewrite the URL like product.php?id=5 to product-5.html.
what is the benefits of rewriting URL?
When a search engine visits the dynamic url like product.php?id=5 it does not give much importance to that URL as search engine sees “?” sign treat it as a url which keeps on changing. so we’re converting the dynamic URL like the product.php?id=5 to static url format like product-5.html. We’ll rewrite the url in such a way that in browser’s address bar it will display as a product-5.html but it actually calls the file product.php?id=5. So that why these kind of URL also named as SEO friendly URL.
what is required for URL rewriting ??
To rewrite the URL you must have the mod_rewrite module must be loaded in apache server. And furthermore, FollowSymLinks options also need to be enabled otherwise you may encounter 500 Internal Sever Error. If you don’t know much about mod_rewrite module then please check this post to know how to check and enable mod_rewrite module in apache?
Examples of url rewriting for seo friendly URL
For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes as your requirement.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]
The following example will rewrite the test.php to test.html i.e when a URL like http://localhost/test.htm is called in address bar it calls the file test.php. As you can see the regular expression in first part of the RewriteRule command and $1 represents the first regular expression of the part of the RewriteRule and [nc] means not case sensitive.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$1
The following example will rewrite the product.php?id=5 to porduct-5.html i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically.
Popularity: 84% [?]
Related Posts
» 5 useful url rewriting examples using .htaccess
» Custom Error Page with .htaccess
» How to check and enable mod_rewrite module in apache
» How to redirect browser to https (ssl) in php
119 Comments on “Hide .php extension with url rewriting using .htaccess”
Trackbacks
- PHP Coding School » Blog Archive » php tips [2008-02-13 14:16:29]
- Rabanomen » Blog Archive » (Direcciones Amigables) Oculta la extensión “.php” con .htaccess
- Custom Error Page with .htaccess
- 5 useful url rewriting examples using .htaccess
- How to check and enable mod_rewrite module in apache of xampp or wamp
- How to redirect browser to https (ssl) in php
- How to redirect browser to https (ssl) in php
- pligg.com
- 5 useful url rewriting examples using .htaccess | Le Kevin dot com
- nayakhabar.co.cc
- How to redirect browser to https (ssl) in php « endo – explosion kiss
- Url Rewrite « OnlineWebHelp
- URL Rewriting for PHP Web Applications Using Apache mod_rewrite extension | TechiePark
- Usefull tips for URL rewriting « New IT Technologies

The “Options +FollowSymlinks” is completely unnecessary. It allows symlinks to point outside your documentroot and has nothing at all to do with rewrites.
If you have problems with .htaccess files not working, try checking your httpd.conf to make sure that it has “AllowOveride All” in it somewhere. Without this line, .htaccess files will not work at all.
great post. i liked it…
mod_rewrite turns your webserver into a super-server and frees it from the constraints of filenames.
Another trick I heard of (want to try sometime) is to turn an error page into a search. For example, if someone tries to type in a wrong page say http://yourserver.com/pagethatdoesntexist.html you redirect it w/ mod_rewrite to http://yourserver.com/search.php?query=pagethatdoesntexist so that you come up w/ links to possibly what the user was looking for instead of a ‘page not found’.
What would have to be put in .htaccess in order to rewrite both .php and .shtml extensions to .html
for rewriting .shtml you have to define another rewrite rule and add a another line like this
RewriteRule ^(.*)\.html$ $1.shtml [nc]
very good idea Michael Hazzard, I would also like to see that happening, and I would do it myself if I knew how to!
could someone email me at alex@kdams.es if they know how to do it please?
thnx
[..]Muchas veces al generar consultas en php en la barra de direcciones quedan lineas completamente inteligibles (por así llamarlo de alguna forma) repletas de signos de interrogación (?) y de igual (=)[...]
Short and to the point. Great post!
If you rewrite .html URLs to .php internal server filepaths you MUST also block direct access to all of the .php URLs. If you don’t block them you will soon have a massive Duplicate Content issue to sort out – with all pages of the site listed with both extensions.
ya i absolutely agree with you…form seo point of view you must do that…
As for the custom 404 pages, what you want is:
ErrorDocument 404 /404.php
In either your .htaccess or your httpd.conf.
Then just create 404.php in your DocumentRoot with your custom searching code contained within. The advantages of this over a redirect to a 404.php page are:
1. A proper 404 HTTP code is sent back so that bots and caching agents will behave correctly
2. The URL doesn’t change so the user can see exactly what they typed in. They will often only want to change the one letter they mis-typed.
The relevant manual page is: http://httpd.apache.org/docs/2.0/mod/core.html#errordocument
Thanks for the link. And you can also check the following post of mine
http://roshanbh.com.np/2008/02/custom-error-page-htaccess.html
for detail about custom 404 pages.
In reply to g1smd, how would you go about blocking off access to .php files if I use this conversion from .php to .html so I don’t have to deal with the issue of duplicate content? Anyone with the answer please email me timmy0621@yahoo.com much appreciated.
Hi Friends,
I want to create SEO friendly URLs in PHP. I know that we can do from .htaccess file but other than that do we have to make some different php script also?
Following is my files:
index.php
Untitled Document
PHP is great
Opensocial in boom
newsdetails.php
<?php
echo ” in news”;
?>
.htaccess file
# //seo_mod_start
Options +Indexes +FollowSymlinks
RewriteEngine On
# Uncomment the following and add your forum path if rewrites arent working properly
RewriteRule ^index.html$ index.php [L,NE]
RewriteRule ^(.*)-a-([0-9]+).html$ newsdetails.php?nid=$1
# //seo_mod_end
But when i view index.php in browser its not showing seo friendly urls of news it shud take title of news to display.
So the final output of url shud be php-is-great.html & opensocial-in-boom.html
Can anybody please help me.
Friends in my above comment there is html code but i think its showing output of code. So view source and see the code.
Hi Roshan, great post
Hi:
I created .htaccess file in my htdocs directory.
used:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php[nc]
Also in apache config file used AllowOverride All.
Restaeted the server, still get a 404 page!
I have a registration.php file, but I’d like to be able to browse to registration.htm file , which would display the php file.
Am I missing a step?
thanx
Kamy
Check weather mod_rewrite module is loaded or not..
http://roshanbh.com.np/2008/04/check-enable-mod_rewrite-apache.html
If it’s loaded then check the file name properly..
it should work…
mod_rewrite is enabled and in fact I got your first tutorial to work (Hiding PHP file extension).
Rechecked everything, restarted apache…. still no go
You’ve the file called registration.php file and you’re typing registration.html in browser’s address bar right ? or you’re doing it in reverse way ? can you tell me in detail ??
Here is a successful technique to
eliminate php file extensions in urls.
http://www.easymodrewrite.com/example-extensions
This post is more than hiding file extension…it basically about url rewriting…
Hi Rishan:
I have a file called registration.php and I’m typing registration.html in browser’s address bar right.
I followed your steps to the letter.
Any suggestions?
thnax
kamy…you are typing registration.html in browser but you’re using “.htm” in your rewrite rule not “.html”, I think that is the main problem…
replace the above code with this
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php[nc]
Roshan:
Thank you for reply.
Still does not work!
I checked my phpinfo file, mod-rewrite is loaded.
I’m wondering if I have another problem? Because I tried what Mikey suggested and that did not work on my system either!!
So I’m thinking that something is off/wrong on my system.
As I said your initial tutorial does work here.
VERY CONFUSDED!
Any ideas?
I appreciate the help.
hey kamy…..send me zip file with that .htaccess file and that php file to bhattarairoshan[at]yahoo[dot]com
let me see what is mistake out there
hi Roshan:
thank you for checking my files.
I made the change , restarted Apache, still does not work !!
Is there anything on Apache config I need to change perhaps?
Kamy
Hi kamy…which apache version you’re using? Well, everything seems to be fine in that code…when I check your files there was only one “space” missing and it worked here.
I’ll send you the zipped working file…just unzip and put that folder inside root folder…..hope that will works
Hi Roshan:
Thank you for the files, but the problem STILL ESISTS!!!
This is now becoming more of a puzzle then anything else.
Running Apache 2.2.8 with PHP 5.2.5
My gut feeling is that something in httpd.config is conflicting with the htaccess file.
Any ideas?
Kamy
Well, this is the biggest puzzle I’ve ever faced. That file was perfectly working here…
try removing Options +FollowSymlinks once…
Hi,
I created .htaccess file in my root directory.
**********
IndexIgnore */*
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php[nc]
**********
My index page is php page when i access my site i am getting this error:
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
Am I doing something wrong
Thanks in Advance
-Praveen
It seems that mod_rewrite is not enabled in your apache server. Check this article to see how to check and enable mod_rewrite module….
http://roshanbh.com.np/2008/04/check-enable-mod_rewrite-apache.html
Hi,
Thanks for reply it is working fine now but i have other links on the same page.
When i access them it shows page name+.php extension.
why?
Thanks in Advance
Well, you need to change the links to the “.html” or whatever your rewrite rule is there and for every different kind of url you need to define different rewrite rule
Thanks for ur reply and support.
It is working fine.
-Praveen
Hi,
I have added this rule to hide index.php file(this is my homepage file):
RewriteRule ^index$ index.php [L]
RewriteRule ^about$ about.php [L]
But this rule is not working, it is giving this error when i access this page:
Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in.
I am accessing index page like:
Home
I am accessing about page like:
About Us
This is working fine.
Why it is not working for HomePage?
Any help is appreciated
Thanks in Advance
-Praveen
As I can see there is [L] flag which means end of the rewrite rule…just remove the [L] flag or put it at the last rewrite rule…and it will work
Hi,
when i access homepage i am getting this error
Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in.
I am accessing my homepage
http://www.example.com/index
In .htaccess file i have written:
IndexIgnore */*
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^index$ index.php
RewriteRule ^passenger$ passender.php
RewriteRule ^aboutus$ aboutus.htm
RewriteRule ^contactus$ contactus.htm
Is there anything i need to change?
Thanks in advance
mod_rewrite is absolutely brilliant. if you know your regular expressions from perl or php they’re easy too!
Hi Roshan,
I tried your example. But its not working. According to someones reply I have to search “AllowOveride All” in httpd.conf file.
But I didn’t found this keyword. So how to make .htacces file working. Please reply me sson.
Byee and have a nice day.
If it’s not here then put the following code in your httpd.conf where you’ve to specify the directoryname in the first line
< directory “D:/xampp/xampp/htdocs” >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</ directory >
Hi Roshan:
I need a help. i am using htaccess file to rewrite the url’s for a project in my local server. the path to the server is something like this.
ip/projectname/html
all the files are inside html folder and the htaccess file also resides there. i have tried to use it for one pf the page. Below is the content of the htaccess file.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index_html$ index1.php[nc]
RewriteRule ^faq$ faq.php[nc]
when i see in browser it still shows the extension.
mod_rewrite and other options are enabled.
please help.
How are you accessing that file ? What did you type in browser to access the index1.php or faq.php file ?
Hi Roshan
I have some problem regarding .htaccess,I have to do folder based Url rewriting in my site.I have also tried the 3rd rule that you have written.
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
But when I use it on any page of my site,all the images on that page are not being displayed.
Can you please help me a little to get out of this problem?
yes you might face this…for this you can use “base” html element for absolute path of image and links
Hi Roshan,
Your example works fine when the pages are all accessed via http. However, if one of the links is pointing to a https URL e.g. user is being redirected to a secure login.html (which is translated by your rule to login.php), the rewrite rule will display a page not found error although the actual php file is there.
How can you make this rule work on both http and https if for e.g. the HTTP host is ‘http://www.example.com’ and the https host is ‘https://web99.secure-secure.com/example.com/’?
Thanks in advance,
Hayden
As you can there is different in the urls in http and https. I think learning about regular expression may help you…
Hi Roshan,
Thanks for the suggestion. Can conditional statements be used in htaccess?
e.g. if-else
I am a newbie and I would appreciate if someone can give me some directions.
Hayden
yes you can use conditional statement in url writing using RewriteCond command…you can check the below post of min where I’ve used many RewriteCond command
http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html
Hello I am designing a site on my localhost using php with apache all the things are done Moderewrite is loaded and all the other things but it is not working without any warning the home page is
http://localhost/cutoutandkeep/homepage.php
and I want it to be
http://localhost/cutoutandkeep/homepage
I have tried your code but it is not working Please help
HI,
Will you please let me know how can I block the users so that they can’t not type .[dot] in the URL?
THanks,
hi
I want the code of hide the URL in GET method using in PHP
If i send
http://www.domain.com/script.php?mod=module&id=id
in that i want to hide script.php?mod=module&id=id
How can i do this
Plese Send The Reply To me
Thanks& Regards
ASHOK
hello,
Nice blog it will really helpful 4 me.but i have 1 question that i already linked my php pages means test link will link to test.php than check will link to check.php but is it possible that if i click on test link it will redirect to test.php but it will show in url test.htm directly or i will change all links from .php to .htm?
How do you enable FollowSymLinks?
Superb posting. This article really helped me a lot on operating.htaccess file.
Hi Roshan..
I’m trying to create affiliate referral program. My intention is to create a link like below:-
http://www.mydomainname.com/username
instead of
http://www.mydomainname.com/?id=username
Does your method can be applied to my program. Sorry for bad english..
@ismail – ya ….it’s the exact solution you’re looking for
RewriteEngine on
RewriteRule ^content-([0-9]+)\.html$ content.php?contentId=$1
this is not working in my page my link is in local server
http://linux2/bablu/admin/content.php?contentId=1
Thanks
how about hiding .html extension?, where to put that .htaccess file?/
Very nice tip.
I was travelling around the net to do something like that.
Thanks a lot.
Check my website later, i`ll post some credit. Thanks again!!
http://www.clicanuncios.com.br
Hai Rouhan…
nice post… and I need that
Btw, how i can make http://www.sitename.com/char.html
The original address like this index.php?page=char
this is my script. but is not work
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ ^index.php?page=$1
can you tell me about this??
please… or send To my email…
how to change index.php to index.html
I have write :
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index(.*)\.htm$ index.php [nc]
in .htaccess file .
i have removed # in httpd.conf from:
LoadModule rewrite_module modules/mod_rewrite.so
to load mod_rewrite module. Am i right?
How can i solve my problem?
thanks and regards
Subash
Hi guys
I am not tech savvy at all but my webdesigners are having this problem with my Yahoo server for webhosting. Qoute “need rewrite_module to be installed in server for executing .htacces or run this code. That’s why i am telling you .htaccess module is not installed in server.
Can you give a quick htaccess example of how you would block direct access to the “.php” to prevent duplicate content from an SEO perpspective? That would be really helpful.
hii roshan….can u please telll me how to enable FollowSymLinks options???
I’ve one website which is simple and static http://www.maryknollnepal.org.np/.
I’ve use .php to include header/menu/footer for simplicity. Now I would like to show filename.html instead of .html. How is it possible?? I tried the above mentioned, not work at all. Hope you understand my problem and help me.
thanks
sudeep
Hi Roshan,
I have files with the name like ‘2.php’ and so on…
in .htaccess file .
I have write :
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9])$ $1.php [nc]
but is not working …
How can i solve my problem?
thanks and regards
Mallik
Hello
I need help in order to hide the extension of a web page in php answer me quickly because that is the demand of my client so i have to deliver it within 5 days .Ok
Thanks
Great article, and great site, i will check and read all articles included, thanks.
can anybody tell me whats the latest PHP version ?
i m also working on that before 3 day’s i also tried above code to remove .php extension but every time i saw .php extension is on the address bar, my mod_rewrite module is enabled, and also showing module section on phpinfo page, but still problem is that i cannot able to remove .php extension is there any other way tell me Or give me any tutorial or example if any u have
if u email me i thankful to you.
Thankx ,
Kashif khatri.
k3.khatri@gmail.com
hi roshan
my mod_rewrite module is enabled,
and also showing module section on phpinfo page,
but still getting problem does not change the extension.
let me know is any thing needed more to change at my end.
i am using latest wamp server 2.0 having latest apache version
my .htaccess file is :
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.htm$ $1.php[nc]
RewriteRule ^(.*)-a-([0-9]+).html$ viewprofile.php?id=$1
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^(.*)\.htm$ index.php [nc]
Hi Mate,
I am trying the below htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)\.htm$ $1.php
I can get the .htm files to call the equivalent .php files no problems but the extensions are not swapping out. How do I get .php to change to .htm?
Cheers
Hi brusca,
(i think that) you are trying to put links like ****.php and you are expecting that the .htaccess make them appear like ****.htm.
you must put links like this <a href=”***.htm”… even if your file has a ****.php extension, and the .htaccess will understand that you are pointing to ****.php .
Thanks coder, I now have my links ?p=variable to look like directories /p/variable/. Thanks and a brilliant article!!
Welcome!
Hi Roshan,
You are doing a great job, but pls help me
I have created a htacess file and wrote the below code:
Options +Indexes +FollowSymlinks
RewriteEngine On
RewriteRule ^test.html$ test.php
But the problem is the above code is working on my server but it is not working on other hosting server. Can you help me where it went wrong?
Hello, i’m having a problem on the rewritting, is this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^product-([0-9]+)\$ products.php?id=$1
And yes, i have the mod_rewrite enabled, i checked the file but continues, can you help?
I like it. Thans a lot mate…
Hi,
write the below code in .htaccess file:
Options +Indexes +FollowSymlinks
RewriteEngine On
RewriteRule ^test.html$ test.php
RewriteRule ^index.html$ index.php
RewriteRule ^products.html$ products.php
RewriteRule ^products-([0-9]+)\.html$ products.php?productid=$1
For example your productid=5 then test the link
http://www.yourwebsite.com/products-5.html
Note: .htaccess file should be in your root folder where index.php file is placed.
Thanks,
Sudhir
Hello, thanks for the help, a some later, when i changed a little thing it works:
Before:
RewriteRule ^product-([0-9]+)\$ products.php?id=$1
After:
RewriteRule ^product-([0-9]+)$ products.php?id=$1
=)
Hi, Roshan
I have read all above comments. I also have the same problem. I m using WAMP server in my local host. First of all please tell me that where I create .htaccess file, means in which directory? Which directory I assume root directory? In WAMP there is bin directory in www, it also contains apache, mysql and php subdirectories, so in which directory i have to create .htaccess file? See, when I execute my localhost file with PHP the my browser shows URL like “http://localhost/bliss/Login.php”. I want to rewrite this with “http://localhost/bliss/Login.html”. Please help me out this problem. I would be very thankful to you. Please…. Waiting for positive reply…please do it as soon as possible…
Regards.
Sumit Joshi
why the hell, do every mid-skilled seo believes that url rewriting is needed in situations like in article provided example.
Why do you think there is any diference in between product.php?id=5 and product-id5.html
if we have hundreds of products? If it was rewriting product.php?id=5 to something like /product/washing-mashine/somemodel, then ok – i agree it has some sense in it. But again ir has no more sense than product.php?item=”washing-mashine”&model=somemodel. Modern search engines do not have any problems with “?” or “&” simbols in url. It hase sence only if you need a nice url for takeaway poster in some trade show or alike.
But now?!!! provided example simply sux and is misleading some not very wise clients who keep asking such stupid questions like – will you hide all “?”
It’s lame. Hiding only because of hiding.
(sorry for English errors if any, it’s not y native lang)
Cheers
hi…Roshan
nice site i learn many php function from ur site
i want to convert
URL http://www.mysite.com/contact-us.php
to >>> http://www.mysite.com/contact-us/
& all other php pages like dis
how to do ..plz mail me ur reply…thankx
I’ve been trying this out, but it hasnt worked. I’m a noob to playing around with PHP etc So this helped a bit with understanding .htaccess, thank you for your tutorial.
Henry.
hi…
Really very useful work.
First, I just wanted to say thank you for this great read. It’s exactly what I’m looking for…mostly. I was hoping you could help me a little because I am confused and haven’t yet found a guide to successfully let me accomplish what I am looking for.
I use a single PHP file for the entire site. I want the links to link to .html when really it is homepage.php?area=. Currently, all links point to homepage.php?area. I found this page on my search to convert all my links to look like ordinary HTML pages.
Any further help would be greatly appreciated. Thanks!
I looked at that last comment and thought some further clarification may be needed.
Let’s say I have a link to services-computers.html. I would like that to then be a page that’s true URL is homepage.php?area=services-computers. The same would be so with about.html, true URL being homepage.php?area=about. Or… contact.html is actually homepage.php?area=contact.
My goal is to have everything pulled from include files as the entire site has the same layout and I would like to be able to easily add and remove layout features as needed.
It is not workingggg…..
thank you it’s very usful
Thanks to your post Roshan it works can you please give another example in url rewrite.
For Example
in my local host i have another folder inside the another folder there is a test.php file
so when i run it in the address bar it should be like this
http://localhost/anotherfolder/test.php
now i want to change it by
http://test.php or
http://localhost/test.php
thanks in advance
How can I rewrite url in php
Hi! all
*** URGENT ***
I am trying the below htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)\.htm$ $1.php
I can get the .htm files to call the equivalent .php files no problems but the extensions are not swapping out. How do I get .php to change to .htm?
After this I tried the code like this:
RewriteEngine on
RewriteRule ^(.*)\.php$ $1.htm [R=302,N]
this changes the extension of the file to .htm but with an error message
Error 404: File Not Found
I want to do it from the redirection only .Because if we do it by making the url as
, then it will affect the ranking of my site.So to maintain the ranking
I want to do it by using redirecting methods.Kindly suggest me about this.
Regards,
Sunil Sharma
Hello, Thanks Very Much Really Helped Me alot.
TKS A LOT FOR YOUR SHARING ITS VERY USEFUL FOR SEO
In windows , If i put .httaccess then showing error.Kindly help me.
I hate the file extension on most of my html pages site, I will play with this one and see how it goes. Kudos for the timely info.
Hi All,
Could you help me in rewritting url ..I am writing url rewritable rule.i want to the caetgory name and sate name change. like this http://www.abc.com/catergory name /state name/state name.html
i want to write a rule that catergory name and state name will change … please help me
Hi,
I checked with all rules mentioned here and we get to convert dynamic web page query string into .html format URL you can see here http://www.addonsolutions.com/Hire-Enterprise-Java-Beans-Developer-Programmer-EJB-Developers-EJB-Programmer.html website design and development page but if can not be converted from PHP to html
any idea?
Thanks
Hi Rishan..what rewriterule i can put in the htaccess if im not using id,,im trying to name for a comment purposes..
Great. I was really want to know this.
Hi Roshan,
I have tried according to the above instructions but i couldn’t get the result. can u help me plz plz….
Here i am working in wamp server, so i have created a url.htaccess in www directory.
Now i created a folder called http access, in that i created a file called product.php
In the url.htaccess
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$5
in the product.php
Name
:
so Finally when i want to access product-5.html, it gives the out put 404 error file not found..
and also i have enable mod_rewrite in the conf directory .htaccess file.
could u please help me …
Hello, please help me, I’m making a server-side rewrite that reads foo=1 when user puts domain.com/category/, thats my code:
Rewriterule ^category/ /?foo=1 [L]
rewrite mod works
But if exists a file called category.php, then rewrite mod doesn’t work
I tried do this:
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^category/ /?foo=1 [L]
and this:
Rewriterule ^category/$ /?foo=1 [L]
and also I tried this:
Rewriterule ^category([^\.php])/$ /?foo=1 [L]
But doesn’t work. I need help Is possible this rewrite?? or i have to delete category.php file?
Thanks
when using url rewriting I find it very easy on the eye without the extension part. It also makes geeks guesses hard to know whats under the hood.
I agree with Jim above, when you use URL rewriting the links to a site or a web application looks neat.