Click here to Skip to main content
16,018,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone,

please how can use mod_rewrite to direct this www.example.com/folder1/folder2/folder3/folder4/file.php?key=1

to www.example.com/key

I have trying this for the past 3hours but no success. thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 26-Jul-13 2:13am    
tarhex 26-Jul-13 2:21am    
thanks, this is what I have tried

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder1/folder2/folder3/$1 [L]

I want to hide the subfolders

1 solution

Everything is well documented.

First of all, mod_rewrite "work better, in many respects, in the main server configuration":
http://httpd.apache.org/docs/current/howto/htaccess.html[^].

Everything is well documented:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html[^],
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html[^],
http://httpd.apache.org/docs/current/rewrite/flags.html[^].

There is no way to help you more without knowing your problems and what have you tried, but you did not bother to tell us about it. So, sorry, but you get exactly as much of advice as you asked for.

—SA
 
Share this answer
 
Comments
Maciej Los 26-Jul-13 2:37am    
Well explained!
+5!
Sergey Alexandrovich Kryukov 26-Jul-13 2:39am    
Thank you Maciej.
—SA
tarhex 26-Jul-13 2:52am    
thanks, this is what I have tried RewriteCond %
{REQUEST_FILENAME} !-f RewriteCond %
{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /
folder1/folder2/folder3/$1 [L] I want to hide
the subfolders

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900