Forum Moderators: phranque

Message Too Old, No Replies

.htaccess woe, pain, and grief

two domains, unwanted subfolders, stressed worker lol

         

delboy1978uk

2:39 pm on Apr 17, 2012 (gmt 0)

10+ Year Member



hey guys
i have a second website in a subfolder /otherweb which gets redirected:


#redirect other sites
RewriteCond %{HTTP_HOST} ^(www.)?otherweb.com$
RewriteCond %{REQUEST_URI} !^/otherweb
RewriteRule ^(/)?$ otherweb/$1 [L]


so you dont see otherweb.com/otherweb in the url, only otherweb.com

this second site on my hosting a zend site so all pages go through index.php in the /otherweb folder


i'm trying to do away with more sub-folderage, but without much luck. ie:

otherweb.com/remove/this/but-keep-this-bit

changing to
otherweb.com/but-keep-this-bit

bearing in mind the actual path is really
otherweb.com/otherweb/remove/this/but-keep-this-bit

the zend htaccess in the otherweb folder looks like this:

RewriteEngine On
Options +multiviews +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]



anyone know how i can get rid of those other two url parts?

lucy24

1:03 pm on Apr 25, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Two parts.

Redirect (RewriteRule with [R=301] flag) from long-messy-url to short-snappy-url, with preceding RewriteCond looking at THE_REQUEST. This determines what the user sees.

Rewrite from short-snappy-url back to long-messy-url where the content really lives.

Found this overlooked post while investigating whether that "10,000 previous posts" is accurate or just a wild exaggeration. May even be an understatement. Heh.