473,804 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to create .htaccess file in PHP

254 Contributor
Hello I want to create .htaccess file in PHP and for website why do we require to have this file. means what are the advantage if I create.
Apr 10 '08 #1
5 2010
Markus
6,050 Recognized Expert Expert
Hello I want to create .htaccess file in PHP and for website why do we require to have this file. means what are the advantage if I create.
.htaccess files are good for many things. One of the more notable possibilities with using .htaccess is the creation of 'pretty urls' where you take a url that looks like
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/?id=this&item=is&auth=now&p=pretty
Quite ugly, no? And change it into this:
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/this/is/now/pretty
Looks alot better, right?

This is all done with simple RewriteRule's

I've heard .htaccess files are pretty resource intensive though.. meaning theyre bandwidth hungry. Not sure about the credibility of this statement, though.

Hope this helps!
Apr 10 '08 #2
mukeshrasm
254 Contributor
.htaccess files are good for many things. One of the more notable possibilities with using .htaccess is the creation of 'pretty urls' where you take a url that looks like
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/?id=this&item=is&auth=now&p=pretty
Quite ugly, no? And change it into this:
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/this/is/now/pretty
Looks alot better, right?

This is all done with simple RewriteRule's

I've heard .htaccess files are pretty resource intensive though.. meaning theyre bandwidth hungry. Not sure about the credibility of this statement, though.

Hope this helps!
Thanks for the information. But how can I create .htaccess file
Apr 11 '08 #3
Markus
6,050 Recognized Expert Expert
Thanks for the information. But how can I create .htaccess file
Create a file, any file, then save the file named as .htaccess

Simple.
Apr 11 '08 #4
mukeshrasm
254 Contributor
Create a file, any file, then save the file named as .htaccess

Simple.
ok but how the url wil look like this

www.somesite.co m/this/is/now/pretty

as you have given example above.
Apr 11 '08 #5
Markus
6,050 Recognized Expert Expert
ok but how the url wil look like this

www.somesite.co m/this/is/now/pretty

as you have given example above.
Well you need to create a rule inside the file.

Try a tutorial on rewriting
Apr 11 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
13191
by: Marko Lahtinen | last post by:
Hello! A part of my website is protected with a .htaccess file. Can I somehow bypass the username/password dialog ?? Can I somehow "hardcode" the authentication name and password in my php-file or can I use for example a html form/mysql authentication and at the same time set some variables or headers (or something) so the user can access the ..htaccess part ? A stupid example: if user presses a button, user gets transferred to the...
8
50627
by: Joshua Beall | last post by:
Hi All, How do I disable magic quotes via .htaccess? I put the following file in my webroot, but it does not disable magic_quotes_gpc (according to phpinfo(), both the local and master value are still "on") <IfModule mod_php4.c> php_value upload_max_filesize 8M
7
7545
by: John | last post by:
Hello. I want to get this blasted .htaccess file sorted out, so I can have sessions without register_globals being on. I have looked everywhere for info on this and I mean everywhere including the php.net manual. In the manual it said to include something like the following:
1
1640
by: John MacLeod | last post by:
I'm having a problem using the .htaccess file to point my local installation of php5 (located at www.mydomain.com/horde/cgi-bin/php5.cgi). As per the instructions I was following I added the following to the .htaccess file (located at www.mydomain.com/horde)... <start quote> #PHP 5.0.5 FINAL without security wrap Action application/x-httpd-phpx /cgi-bin/php5.cgi AddType application/x-httpd-phpx php php3 phtml php4 php5 <end quote>
0
2003
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I just need a short php script that just asks the webserver what the rights are. That seems a reasonable wish to me. If this is however not possible than I'd like a script that can
4
2814
by: Stefan Bellon | last post by:
Hi all! I want to parse the contents of an .htaccess file from within PHP. The contents of the .htaccess file looks like this: <Files foobar.tar.gz> AuthType Basic AuthUserFile /foobar AuthName "Foobar" <Limit GET>
1
4901
by: nickyeng | last post by:
I have checked this info from apache website, and i confused with it. Procteing System files it said: To run a really tight ship, you'll want to stop users from setting up .htaccess files which can override security features you've configured. Here's one way to do it. In the server configuration file, put
0
11290
by: asherwolf | last post by:
Hi, I'm trying to do something I think is pretty neat, but I've just about pulled my hair out by the behavior of my server. I'm hosting on GoDaddy, using a subdomain (www.mywebpage.com maps to /mywebpage), running Apache 1.3.33, and PHP 4.3.11. The goal is to use PHP to install an .htaccess file in a folder to forbid PHP files from being accessed from outside the server. I have a working .htaccess file in one folder, and I have been...
0
2138
by: deco12 | last post by:
Hi, I am new to web design and Apache, but have managed to password protect my site by putting a .htaccess file in the sites root directory. I have set it up so that a number of members have access to the site. Now, within the site I have a link to a "document" folder which I only want 2 or 3 members to have access to. I have created a second .htaccess & .ht passwd file, with the path to the new folder and a different password. This was...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.