htaccess rewrite rule
Moderator: General Moderators
-
rajsekar2u
- Forum Commoner
- Posts: 71
- Joined: Thu Nov 20, 2008 4:23 am
htaccess rewrite rule
HI,
This is the first time am using htaccess. I didn't have much knowledge in this. Please help me.
I need a rewrite rule which have to hide everything other than the site's base URL.
Eg. If the site URL is "http://example.com/index.php?id=1"
then it should show only "http://example.com/"
I've tried somethings but i didn't got the result.
This is the first time am using htaccess. I didn't have much knowledge in this. Please help me.
I need a rewrite rule which have to hide everything other than the site's base URL.
Eg. If the site URL is "http://example.com/index.php?id=1"
then it should show only "http://example.com/"
I've tried somethings but i didn't got the result.
Re: htaccess rewrite rule
You can't hide the URL like that.
-
rajsekar2u
- Forum Commoner
- Posts: 71
- Joined: Thu Nov 20, 2008 4:23 am
Re: htaccess rewrite rule
Hi,
Thanks for your reply.
Then is it possible to show as a folder
Thanks for your reply.
Then is it possible to show as a folder
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: htaccess rewrite rule
I think that what tasairis means is that you cannot use .htaccess to change what appears in the address bar of the browser. You can however use it to "divert" a request for one url (eg "mysite.com/podcasts") to a different url ("mysitecom/index.php?page=podcasts").
If you want to change the address as it appears in the address bar, you need to look at Javascript.
If you want to change the address as it appears in the address bar, you need to look at Javascript.
Re: htaccess rewrite rule
You can change what is in the address bar by not including the file extension.
ex) <a href="home"></a> It will look something like www.yourwebsite/home in the address bar
This will bring you to a file called home in the current directory, I am not too sure how it work when there are other files with the same name but different extensions.
Hope this helps.
ex) <a href="home"></a> It will look something like www.yourwebsite/home in the address bar
This will bring you to a file called home in the current directory, I am not too sure how it work when there are other files with the same name but different extensions.
Hope this helps.
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: htaccess rewrite rule
I don't think this is quite right. http://www.mysite.com/home points to the directory "home". If the "home" directory exists, the server will look for a file "index.html" in the home directory, or - failing that, and depending on configuration settings - it will look for "index.php". If there is no index file, the server will return a "not found" error, or will display a list of the contents of the "home" directory, again depending on config settings. If the "home" directory does not exist, the server returns a "not found" error.
Re: htaccess rewrite rule
If you're using Apache and have the MultiViews option enabled, Apache will look for files with known extensions after checking for matching directories. Thus "/home" could refer to the /home directory or the /home.* file.
It doesn't count just any extension - it has to know about it first, like through an AddHandler or AddType directive.
It doesn't count just any extension - it has to know about it first, like through an AddHandler or AddType directive.
Re: htaccess rewrite rule
while on the topic, what do I change in order to be able to use index.php (instead of index.html, ie: http://www.mysite.com) as my home page?
Re: htaccess rewrite rule
DirectoryIndex in your .htaccess. Most preferred filenames left, least preferred right.manRay wrote:while on the topic, what do I change in order to be able to use index.php (instead of index.html, ie: http://www.mysite.com) as my home page?
Code: Select all
DirectoryIndex index.php index.html