Results 1 to 13 of 13
Thread: Delete "index.php" from the URL
-
03-06-2012, 10:33 AM #1WHT Addict
- Join Date
- Feb 2012
- Posts
- 137
Delete "index.php" from the URL
Hi,
Does somebody know how to delete the "index.php" in from the URL pointing to the home page?
I have a web domain "www.myomain.com" but there is always index.php.mydomain appears after 'com'and becomes:
www.mydomain.com/index.php/mydomain.
How to keep only www.mydomain.com without index.php and other following annex ?
Thanks
-
03-06-2012, 10:37 AM #2Web Hosting Master
- Join Date
- Mar 2009
- Location
- Miami, Florida
- Posts
- 20,777
Hello,
This can be done with Apache mod_rewrite and a htaccess file
-
03-06-2012, 10:55 AM #3WHT Addict
- Join Date
- Feb 2012
- Posts
- 137
-
03-06-2012, 12:15 PM #4Web Hosting Master
- Join Date
- Mar 2010
- Location
- Upstate New York
- Posts
- 1,452
████ John Rasri
████ Private Label Live Chat Provider For Resellers
████ GotLiveChat.com
████ White Label/Brand-able live chat software solutions
-
03-06-2012, 12:24 PM #5Dennis Johnson
- Join Date
- Jun 2001
- Location
- Kalamazoo
- Posts
- 33,412
Or, more specifically, something like
Code:Options +FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
There is no best host. There is only the host that's best for you.
-
03-06-2012, 01:07 PM #6Web Hosting Master
- Join Date
- Mar 2009
- Location
- Miami, Florida
- Posts
- 20,777
-
03-06-2012, 01:09 PM #7Disabled
- Join Date
- Nov 2011
- Location
- Nasik, MH,INDIA
- Posts
- 862
Please use the following rewrite rules for more help.
# Turn on rewrites.
RewriteEngine on
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/directory/
# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /directory/$1
-
03-06-2012, 01:17 PM #8Junior Guru Wannabe
- Join Date
- Dec 2011
- Posts
- 91
RewriteEngine On
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
-------------------------
place this inside a file named .htaccess in your web docroot. This only applies to Apache. Nginx has a different rewrite syntax
/etc/httpd/conf/httpd.conf must have the following line uncommented
LoadModule rewrite_module modules/mod_rewrite.soLast edited by machinez; 03-06-2012 at 01:20 PM.
BigInstance.com
[+] VPS - KVM HVM - 4GB & up
[+] Dedicated CPU core(s)
sales [@] biginstance.com
-
03-06-2012, 03:46 PM #9WHT Addict
- Join Date
- Feb 2012
- Posts
- 137
Thank you guys. I tried all the codes you pastes here but I still have the 'index.php'!
I maybe processed it wrongly but, here is how I did:
- enabled re-write mode in Apache,
- open a new text file,
- copied/paste the text you posted here,
- save the file as .htaccess in the www root folder
- close
- refresh et check the url, I still see www.mydomainn.com/index.php/mydomain !
Any idea to fix this?
Thank youLast edited by Hostalker; 03-06-2012 at 03:50 PM.
-
03-06-2012, 03:48 PM #10Web Hosting Master
- Join Date
- Mar 2009
- Location
- Miami, Florida
- Posts
- 20,777
-
03-06-2012, 04:29 PM #11Junior Guru Wannabe
- Join Date
- Dec 2011
- Posts
- 91
make sure in your conf file you enable overrides, you'll need them for .htaccess
in /etc/httpd/conf.d/yourconffile.conf. You may have to replace directory with your own if the docroot is different.
if you edit your conf file it requires a reload of Apache. "sudo /sbin/service httpd reload"
<directory /var/www/html/>
AllowOverride all
</directory>BigInstance.com
[+] VPS - KVM HVM - 4GB & up
[+] Dedicated CPU core(s)
sales [@] biginstance.com
-
03-07-2012, 06:14 AM #12Aspiring Evangelist
- Join Date
- Jun 2011
- Location
- Karlstad, Sweden
- Posts
- 354
Monitor Scout - Website & Server Monitoring
50 different checks, SNMP monitoring and much more.
https://www.monitorscout.com
-
03-07-2012, 08:38 AM #13WHT Addict
- Join Date
- Feb 2012
- Posts
- 137
I am using windows, it didn't work!
Similar Threads
-
How can I change the "index of" directory listing page?
By chasebug in forum Hosting Security and TechnologyReplies: 5Last Post: 08-01-2010, 09:24 AM -
"index page"
By chamelion in forum Hosting Security and TechnologyReplies: 1Last Post: 12-19-2006, 01:42 AM -
My site shows the "index of/" page
By Alethea in forum Web Design and ContentReplies: 22Last Post: 05-19-2005, 03:41 AM -
How to get rid of the "index of/" page?
By Alethea in forum Web Design and ContentReplies: 5Last Post: 05-05-2005, 11:07 AM -
What's wrong with ServerHost.com? Comes up with "Index of /" page
By dabystru in forum Dedicated ServerReplies: 9Last Post: 10-26-2001, 07:51 AM