Hello, I've tried to do this - i carnt, so if someone can do it -- i'll paypal them $20. I need the following.... Force http://site.com to http://www.site.com (Add www) Make http://www.site.com/page into http://www.site.com/page/ (Trailing Slash) Work with ANY domain - So no mention of actual domain or tld in htaccess. Can be dragged into any site, without editing the htaccess file. And finally, every request should actually be redirected to the index as variables if the real page does not exist. Example: http://www.site .com/page/ <--- is actually showing site.com/index.php?a=page http://www.site.com/page/3 <--- is actually showing site.com/index.php?a=page&b=3 Only 2 variables are needed. - some requests may only have 1, some may have 2. If a user tries to load a real page, the real page should be shown, not the redirected to index page. The file i wrote worked perfect -- but i've been told that it does unnecessary redirects. So i'm really looking for a highly optimized htaccess file, that only does the redirects it needs to. $20 goes to the solution others agree is the best way to do it. If theres only one solution - they get it, if multiple solutions but no one says which is best -- its the first person who posted it. Thanks for reading! I hope someone can do the above -- as it's been a nightmare trying to do it. I hate htaccess files lol.
If you have mod_rewrite module in apache is very simple to do that..Give me more detaile on PM about your apache/server configuration and i can help you fast
is this been solved? where's your site?(just pm me for th url if you wnat hide the site from public.,;if you still need a help)
Thanks for the replies guys. kishor213 is the only one to PM me a solution so far - but it includes "YourSite.com" style rewrite rules -- where the htaccess file would need to be edited each differernt site it is used on. I really need it to pick up the domain from the server itself. (Unless someone can say a reason why this isnt a good idea) Let me post the htaccess file i wrote... I have been told that it is bad, because it does too many redirects. So im looking for improvements. Options +FollowSymlinks RewriteEngine On RewriteBase / # ADD / FORWARD SLASH RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$ RewriteRule ^(.*)$ [%{HTTP_HOST}...] [R=301,L] # ADD WWW RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ [%{HTTP_HOST}...] [R=301,L] # REDIRECT TO INDEX EVERY TIME RewriteRule ^([0-9a-zA-Z-]+)/?(([0-9a-zA-Z-]+)/)?$ /index.php?p=$1&l=$3 [L] Code (markup): Remember, it's the first person to post a htaccess file in this THREAD that others agree is the best way to do it that gets the $20. Or if only one reply - that person. As long as it's better then my htaccess attempt Thanks again guys!
RewriteEngine on Options FollowSymlinks rewritecond %{http_host} ^Yoursite.com [nc] rewriterule ^(.*)$ http://www.yoursite.com/$1 [r=301,nc] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ RewriteRule (.*)$ http://yoursite.com/$1/ [R=301,L] Not fit for $20 since it need the site url..! But hope i can get 10 or $15 well it deserves i think..!
Well.. Your Script too looks fine.... And will work fine i hope..! I cant find any Thing wrong there..!
Still looking for help guys! It must be an easy one for you Apache/htaccess experts Nobody want $20? lol. Cheers.