justin7410 Posted August 16, 2013 Share Posted August 16, 2013 (edited) Hey guys, i have a .htaccess file that i am trying to modify. apparently i modified this before to remove extensions from being necessary ( i.e .php) then i made a modification to remove the www from the URL so that it would be strictly http://websitenamehere.com this did not work and i tried to remove the code from the .htaccess file, as you will see there is no code now for this. Yet, when go to the site it works and shows its SERP as websitename.com. this is extremely frustrating and looks very amateurish. .HTACCESS FILE RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /profile.php?username=$1 # ---- Establish a custom 404 ErrorDocument 404 /filenotfound.php # ---- Prevent directory file listing index IndexIgnore * # ---- Make Pages render with no ext Options +Multiviews AuthName "websitename.com" AuthUserFile "/home/websitename/.htpasswds/public_html/passwd" also on a side issue if anyone has any input, how can i remove the .index extension from showing, i want to to a redirect from the .htaccess file, where instead of index.php it would just show the domain.name. Thank a bunch guys, any suggestions or help would be great. Edited August 16, 2013 by justin7410 Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/ Share on other sites More sharing options...
requinix Posted August 16, 2013 Share Posted August 16, 2013 # ---- Prevent directory file listing index IndexIgnore * Options -Indexes is better. also on a side issue if anyone has any input, how can i remove the .index extension from showing.php extension? Enabling MultiViews should let you do that already. Try it. i want to to a redirect from the .htaccess file, where instead of index.php it would just show the domain.name.Then don't put /index.php in the link. Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/#findComment-1445277 Share on other sites More sharing options...
justin7410 Posted August 16, 2013 Author Share Posted August 16, 2013 # ---- Prevent directory file listing index IndexIgnore * Options -Indexes is better. .php extension? Enabling MultiViews should let you do that already. Try it. Then don't put /index.php in the link. Hey, Thanks for the reply ! your post was very helpful but not quite as helpful as i needed. i dont think i stated my issue clearly. i want index.php to be the file that is being directed to, but while index is being directed to , using .htaccess you can redirect the index file to your main page without showing the file name. using MultiViews only removes the extension of .php not the file name. I thought using IndexIgnore * or -Indexes would accomplish what i was trying to do with that issue. Yet, nothing happens for either, im still directed to the index file with index showing. My main issue of www. not showing up in my URL is what i really want an answer to or solution if anyone can help. just look at the OP and you will get a better idea of the issue at hand. thanks Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/#findComment-1445412 Share on other sites More sharing options...
requinix Posted August 16, 2013 Share Posted August 16, 2013 i want index.php to be the file that is being directed to, but while index is being directed to , using .htaccess you can redirect the index file to your main page without showing the file name.And as long as index.php is a DirectoryIndex and as long as you don't actually link to "/index.php" then it will work without changes. using MultiViews only removes the extension of .php not the file name. I thought using IndexIgnore * or -Indexes would accomplish what i was trying to do with that issue. Yet, nothing happens for either, im still directed to the index file with index showing.I guess I was confused and thought that when you said to remove the extension that you wanted to remove the extension. I should have known you meant the entire file name. My main issue of www. not showing up in my URL is what i really want an answer to or solution if anyone can help. just look at the OP and you will get a better idea of the issue at hand.It's not going to do that after you remove any code that tries to remove the "www" subdomain. So... put the code back in. If you have problems making it work then we need to see what you have, not what you don't have. Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/#findComment-1445436 Share on other sites More sharing options...
justin7410 Posted August 17, 2013 Author Share Posted August 17, 2013 And as long as index.php is a DirectoryIndex and as long as you don't actually link to "/index.php" then it will work without changes. I guess I was confused and thought that when you said to remove the extension that you wanted to remove the extension. I should have known you meant the entire file name. It's not going to do that after you remove any code that tries to remove the "www" subdomain. So... put the code back in. If you have problems making it work then we need to see what you have, not what you don't have. Yes i would love to show you the sourced code for the issue. one of the head scratching things about this issue is, this file you see in the OP is the live website .htaccess file. So for showing you what i have and dont have, that is basically the "whole enchilada" sort of speak. If you have any suggestions as to why there is hidden code in the .htaccess file ? i have tried to edit it through both cpanel ( legacy file manager) & notepad++ , both show the OP code. thanks again man Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/#findComment-1445453 Share on other sites More sharing options...
justin7410 Posted August 17, 2013 Author Share Posted August 17, 2013 And as long as index.php is a DirectoryIndex and as long as you don't actually link to "/index.php" then it will work without changes. i am sorry , i am a somewhat noob when it comes to PHP , can you elaborate a bit what you mean by a DirectoryIndex ? i also link to my index.php ( for ex : if i have a website logo and a user clicks on the logo, it should take the user back to the index.php, which is your homepage.) my index.php is located in my www directory Quote Link to comment https://forums.phpfreaks.com/topic/281225-htaccess-file-not-showing-proper-url-how-to-redirect-from-index/#findComment-1445454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.