ozestretch Posted January 30, 2010 Share Posted January 30, 2010 This is a lead on of a previous question (which was solved but may have caused this issue) This is how I want it to operate. domain.com, domain.com/xxxx to have trailing slashes domain.com/xxxx+, domain.com/xxxx+all to not have trailing slashes www.domain.com redirect without www sub.domain.com to not inherit any rules if possible - currently redirects to actual subfolder domain.com/sub/ domain.com/anyfilename.php to be domain.com/anyfilename/ (go.php checks to see if database record, if not it checks for actual file/folder) <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteCond %{REQUEST_URI} ([^+])$ RewriteCond %{REQUEST_URI} !([a-zA-Z0-9]\+(all))$ RewriteRule (.*)$ http\:\/\/domain\.com\/$1\/ [QSA,R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} !^domain\.com$ [NC] RewriteRule ^(.*)$ http\:\/\/domain\.com\/$1 [QSA,L,R] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9A-Za-z]+)/?$ /go.php?id=$1 [QSA,L] RewriteRule ^([0-9A-Za-z]+)\+/?$ /info.php?id=$1 [L] RewriteRule ^([0-9A-Za-z]+)\+all/?$ /info.php?id=$1&all=1 [L] </IfModule> it all 'seems' to do as I want, except the subdomain issue Quote Link to comment https://forums.phpfreaks.com/topic/190358-subdomain-redirecting-to-actual-subfolder-but-dont-want-it-to/ Share on other sites More sharing options...
ozestretch Posted February 2, 2010 Author Share Posted February 2, 2010 If anyone can shed some light on the subdomain issue, I'd appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/190358-subdomain-redirecting-to-actual-subfolder-but-dont-want-it-to/#findComment-1005387 Share on other sites More sharing options...
cags Posted February 2, 2010 Share Posted February 2, 2010 You only appear to check the domain for the second rule. If you don't want sub-domains to follow a rule then apply the RewriteCond for the domain before the rule. Quote Link to comment https://forums.phpfreaks.com/topic/190358-subdomain-redirecting-to-actual-subfolder-but-dont-want-it-to/#findComment-1005435 Share on other sites More sharing options...
ozestretch Posted February 2, 2010 Author Share Posted February 2, 2010 thanks, made me look at the whole PICTURE.... Redirect 301 /index.php http://domain.com/home/ forgot I had that outside my mod_rewrite removed and added a php 301 header redirect in index.php is there a better way in .htaccess to do Redirect 301 /inde.... etc? Quote Link to comment https://forums.phpfreaks.com/topic/190358-subdomain-redirecting-to-actual-subfolder-but-dont-want-it-to/#findComment-1005592 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.