luke777 Posted January 30, 2010 Share Posted January 30, 2010 Hey guys, I really hope someone can help me i totally suck with htaaccess! redirect a /var to php script like makepage.php?id=var All i really want to do it have like if someone comes to the site and types "www.site.com/page" then the address bar will stay the same but the page will be read from "www.site.com/script.php?id=page" I thought it would be pretty easy and have messed round with a bunch of codes but given up n decided to leave it for an expert If anyone could space a minute to help me with this i'd appreciate it more than you know! Quote Link to comment https://forums.phpfreaks.com/topic/190364-htaaccess-anyone-will-know-this-i-just-suck-please-help/ Share on other sites More sharing options...
scotmcc Posted January 30, 2010 Share Posted January 30, 2010 Hi Luke777, It sounds like you're looking for mod_rewrite help. There is a great article here: http://corz.org/serv/tricks/htaccess2.php If you have trouble once you've read the article and tried writing some code, post the code here so we can be a little more specific with our answers. An example from the above site: ...would be a neat trick, enabling anyone to access my blog archives by doing.. http://corz.org/blog/2003-nov in their browser, and have it automagically transformed server-side into.. http://corz.org/blog/index.php?archive=2003-nov Options +FollowSymlinks RewriteEngine on RewriteRule ^blog/([0-9]+)-([a-z]+) http://corz.org/blog/index.php?archive=$1-$2 [NC] Thanks, Scot Quote Link to comment https://forums.phpfreaks.com/topic/190364-htaaccess-anyone-will-know-this-i-just-suck-please-help/#findComment-1004259 Share on other sites More sharing options...
luke777 Posted January 30, 2010 Author Share Posted January 30, 2010 my .htaccess now contains RewriteEngine on RewriteCond %{HTTP_HOST} ^mysite.com[NC] RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] rewriteEngine On rewriteBase / rewriteCond %{HTTP_HOST} ([^.]+)\.mysite.com [NC] rewriteCond %{HTTP_HOST} !^www\.mysite\.com rewriteRule ^$ /turf/grabpage.php?page=%1 RewriteEngine on RewriteRule ^files/([^/]+)/([^/]+) /turf/grabpage.php?page=$1&file=$2 [NC] Options +FollowSymlinks With this i tryed going to mysite.com/files/test .... which should have read from /turf/grabpage.php?page=test And basically made a page about "test" But it didn't Need some helps guys, im good with most things but htaccess just gets me everytime Quote Link to comment https://forums.phpfreaks.com/topic/190364-htaaccess-anyone-will-know-this-i-just-suck-please-help/#findComment-1004331 Share on other sites More sharing options...
ozestretch Posted January 31, 2010 Share Posted January 31, 2010 i'm no expert, but shall offer an eye. i am pretty sure only need to register engine base etc once. also %1 should be $1 ? Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^mysite.com[NC] RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] # rewriteCond %{HTTP_HOST} ([^.]+)\.mysite.com [NC] rewriteCond %{HTTP_HOST} !^www\.mysite\.com rewriteRule ^$ /turf/grabpage.php?page=$1 # RewriteRule ^files/([^/]+)/([^/]+) /turf/grabpage.php?page=$1&file=$2 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/190364-htaaccess-anyone-will-know-this-i-just-suck-please-help/#findComment-1004449 Share on other sites More sharing options...
luke777 Posted January 31, 2010 Author Share Posted January 31, 2010 no homepage still shows page about blank grabbed from grabpage.php How can i make the homepage mysite.com/ show mysite.com/index.html without making it obvious to the user! Quote Link to comment https://forums.phpfreaks.com/topic/190364-htaaccess-anyone-will-know-this-i-just-suck-please-help/#findComment-1004721 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.