apache - How do I redirect a subdirectory and all files in it to the root using htaccess? -


I am trying to restore all the instructions to the subdirectory and any file in the root file, using htaccess . Currently, I have redirected to 301 / directory / / but it redirects with the request added to it in the root .. ie www.domain.com/directory/this.html Redirect www.domain.com/this.html I don not want to request that file at all. Is there any way to do this?

thanks

You probably use mod_rewrite Have to do. Assume that you keep .htaccess in the root directory, something like that should be done.

  & lt; Ifmodule mod_rewrite.c & gt; Riverlighting On Rewrite Raul ^ Name-The Subfolder /.*$ / [R = 302] & lt; / IfModule & gt;  

NB I have kept 302, because it is always usable for testing, 301 can change the pain test with your browser. Feeling free to change to 302 after working.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -