last day (16 days later) » 

8:51 PM
0
A: 301 Redirect Remove first directory

anubhavaUsing mod_rewrite keep this rule very first rule just below RewriteEngine line: RewriteEngine On RewriteCond %{REQUEST_URI} !^/(videos|images|category)/ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^[^/]+/([^/]+/[^.]+)$ /$1 [L,NE,R=301]

 
This doesnt seem to do the trick. I get redirect to just the subdomain and no css files load.
Okay. This seems to do the trick however it conflicts with other urls that i have such as example/videos/video/myvideo.html. It makes it example.com/video/myvideo.html. How can I opt out of certain directories I can define.
It doesnt work for the same reason i mentioned above. I would like it so doesnt have the effect for certain directories such as videos,
 
check updated code to skip some directories from this rewrite
 
OKay the code does work however i have some urls which are longer and unfortunately would not work with the rules. Eg. example.com/memorial-photos/category/3064/tylernickelson would show as example.com/3064/tylernickelson even if i tell it to skip /memorial-photos/
 
There is no way to stop that since above rule will redirect twice. First /memorial-photos/category/3064/tylernickelson to /category/3064/tylernickelson and then /category/3064/tylernickelson to /3064/tylernickelson . May be a fix will be to replace first RewritCond to RewriteCond %{REQUEST_URI} !^/(videos|images|category)/ [NC]
 
The way the rule is make is stay as /category/3064/tylernickelson without the memorial-photos
 
8:51 PM
Didn't undertake your comment. You can use my suggested rewrite condition in previous Comment.
 
Well Id like it to skip memorial-photos, right now its removing memorial photos still so the pages till dont render but leaving category. Would this work? RewriteCond %{REQUEST_URI} !^/(videos|images|memorial-photos/category)/ [NC] ??
Hi
 
did you try current rule?
that will redirect /memorial-photos/category/3064/tylernickelson to /category/3064/tylernickelson
 
Yes the current rule you have will do that exactly
but i dont want it to do that
 
then?
 
id like it to leave those urls the way they are
and opt out of that directory entirely
 
8:54 PM
oh ok but what you mean by opt out of that directory
 
well make it not do any redirects on memorial-photos
just on the first type of urls i have stated at the begining
i dont want it to do it for videos nor memorial-photos
just the urls i have stated at the begining
 
ok try my updated rule now
 
Okay it seems to work now.
I will do further testings. Thank you very much for helping me out
 
you're welcome
take care
 

  last day (16 days later) »