0

I have some folders where are structures like this

test >main >pages>general(inside pages I have my index.php, contact.php etc)

at the moment my url looks something like this

www.test.com/test/main/pages/general.index.php

how can i rewrite this so i can cut all the folders out and just show

www.test.com/index.php

I have done

RewriteEngine on

AuthUserFile "/home/amytesting/.htpasswds/public_html/passwd"
AuthName "root"
AuthType Basic
require valid-user
Options -Indexes

RewriteCond %{HTTP_HOST} ^test\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com
RewriteRule ^/?$ "http\:\/\/test\.com/\ " [R=301,L]
gunr2171
  • 16,104
  • 25
  • 61
  • 88
Amy
  • 55
  • 10
  • 2
    Possible duplicate of [how to remove folder name from url using htaccess](http://stackoverflow.com/questions/18973058/how-to-remove-folder-name-from-url-using-htaccess) – Machavity Aug 23 '16 at 23:07

1 Answers1

1

You can try this simple htaccess code :

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.test.com$
RewriteRule ^contact$ http://contactx.test.com/contactX/contact-question.cfm
Lucas Willems
  • 6,673
  • 4
  • 28
  • 45
  • if I put index.php does that mean i need to put all the other files or isnt they a best way to just say if folder in general it should cut out the all the other folders? – Amy Jul 18 '13 at 21:27
  • i dont want to show `www.test.com/test/main/pages/general.index.php` i want to show `www.test.com/index.php` – Amy Jul 18 '13 at 21:38
  • basically anything in the general folder should be cut out to `www.test.com/THE FILE NAME – Amy Jul 18 '13 at 21:39
  • if u sent the website... `www.test.com` i want it to show the index.php page. when u click on any of the nav link like contact page it whould be `www.test.com/conatct.php` or www.test.com/contact` – Amy Jul 18 '13 at 21:46
  • i just found out why my code wasn't working it because godaddy windows plan doesn't support .htaccess – Amy Jul 19 '13 at 09:09
  • But you can't move your page ? – Lucas Willems Jul 19 '13 at 09:32
  • It was my first time buying a url and web hosting with godaddy... I choose windows plan but i didnt know it only support ASP languages only all my file are `.php` which means i should have choose `linux`. I cant windows windows because all my files are save as `.php`. – Amy Jul 19 '13 at 09:37
  • Yes it's not a problem. You can move your files to the root folder and rename them. – Lucas Willems Jul 19 '13 at 09:45
  • `rename` my file to `aspx`? do u have any experience using godaddy? – Amy Jul 19 '13 at 09:47
  • No. I don't. But you are using php file and it seems that there are no problems. – Lucas Willems Jul 19 '13 at 09:48