Jump to content

htaaccess, ANYONE will know this! i just suck please help...


luke777

Recommended Posts

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  :confused:

 

If anyone could space a minute to help me with this i'd appreciate it more than you know!

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

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 :confused:

 

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.