![]() |
htaccess q.
Got a folder with loads of content called /subdirectory/blah/ want to leave the content in there but use htaccess to call it /anotherdirectory/blah/
so if people click a link for domain.com/subdirectory/blah/ they get the content for domain.com/subdirectory/blah/ but the newurl is domain.com/anotherdirectory/blah/ Does that make sense? htaccess confuses the fuck out of me. Can never work out what can/cant be done. I know if I moved the content I can do it with a 301, but if the content hasnīt moved, will it still work? RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L] |
:2 cents: :pimp
|
the redirect does the job, it shows the correct url, but the content doesnt show.
I get a 404 on the directory /new/ and Error 310 (net::ERR_TOO_MANY_REDIRECTS): on /new/blah/ The content on the server is still in /old/ I just want the url to show /new/ sort of like a slug rename in wp. maybe I cant do it in htaccess without moving the content. its a custom wp post type, so a bit tricky. |
i did something like this before on one of my blogs... but i cannot seem to find the htaccess file i used back then...
I suppose it's basically (got this from stackoverflow): //begin code RewriteCond %{REQUEST_URI} !^v2/ RewriteRule ^(.*)$ v2/$1 [L] //end code Basically, you have a condition when to rewrite, in this case: the url cannot end with v2/ In case the uri doesn't end with v2/, everything after the domain will be rewritten to the v2-directory... in your case, it will be something like //begin code RewriteCond %{REQUEST_URI} ^firstdirectory/ RewriteRule ^(.*)$ seconddirectory/$1 [L] //end code I'm not an htaccess guru, try it out for yourself, and see if it works ;-) |
nope that doesnīt want to work either. thx for trying though.
I think Iīm going to have to copy over all the posts, then set up a standard 301 just to take care of the existing links. |
you are probably missing something simple, icq me 33375924 and I'll work it out for a beer or 2...
|
Quote:
Thougth the changing post types was going to be a pain but found a plugin that did it. thanks for the offer though. |
Quote:
Plugins can add an extra layer of redirects. Put it on a virtual host and you can have even more rewrites and server-crushing loops. It's the internal rewrites that cause a lot of headaches for those that don't know they're there :2 cents: |
Quote:
|
All times are GMT -7. The time now is 04:28 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc