FreePgs.com Forum
September 20, 2021, 05:09:20 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: LVCS.NET offers low cost domain registration services.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: HTACCESS  (Read 5742 times)
Osprey
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 226

Blog entries (0)

View Profile WWW
« on: May 02, 2006, 11:31:13 AM »

Hey Guys,

I'm working on a new site which requires mod rewrite..

Unfortionately i'm not too familiar with this .. basically i would like to change this url (for example) http://site.com/namehere ----->  http://site.com/page.php?code=1234

If possible, i would also like to be able to change http://site.com/namehere/number to http://site.com/page.php?code=1234number=1234

I tried altering the HTACCESS before, it did "redirect" (I know it doesn't really redirect) as intended.. but it also changed the hyperlinks in the document itself? (Images and CSS files were not loading is they should have..) I would have thought this was possible? Alternatively i could use a special subdomain eg. users.site.com/namehere ?

Any help much appreciated! Never touched the HTACCESS file before at all!

Thanks,
Logged

sven
Verified Account
Jr. Member
*

Karma: +0/-0
Offline Offline

Posts: 54


heeere kitty, kitty ...

Blog entries (0)

View Profile
« Reply #1 on: May 05, 2006, 12:24:16 AM »

Speaking as a fellow newbie to htacess files, I can't really answer your question, however if you hadn't found it before let me recommend this tutorial that helped me grok some of the concepts: http://system.freepgs.com/manual/howto/htaccess.html

Good luck...
Logged

--
"Everything is futile!"
    -- Marvin of Borg
FreePgs.com Forum
« Reply #1 on: May 05, 2006, 12:24:16 AM »

 Logged
Osprey
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 226

Blog entries (0)

View Profile WWW
« Reply #2 on: May 06, 2006, 08:11:09 AM »

Thanks for the link Sven.

I've not got it setup to a reasonable standard, it is using a real redirect though [R] - Without really redirecting somehow it was fiddeling with the external CSS/PHP/Image files and they weren't loading.

- Osprey
Logged

Evilsprouts
Verified Account
Full Member
*

Karma: +1/-0
Offline Offline

Posts: 243


Blog entries (0)

View Profile WWW
« Reply #3 on: May 06, 2006, 12:26:15 PM »

Does anyone know of a good guide for HTACCESS by any chance please?

Sorry about the topic hijack but no point making a new topic just for this Smiley
Logged
FreePgs.com Forum
« Reply #3 on: May 06, 2006, 12:26:15 PM »

 Logged
Osprey
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 226

Blog entries (0)

View Profile WWW
« Reply #4 on: May 06, 2006, 06:16:03 PM »

No worries Evilsprouts, i'd also find it usefull.

I'd really like to know how to avoid it from altering URLS inside the document,
Logged

neosquared
Coding until my eyes bleed..
Verified Account
Jr. Member
*

Karma: +1/-0
Offline Offline

Posts: 51

Blog entries (0)

View Profile WWW
« Reply #5 on: May 13, 2006, 09:52:18 PM »

Thanks for the link Sven.

I've not got it setup to a reasonable standard, it is using a real redirect though [R] - Without really redirecting somehow it was fiddeling with the external CSS/PHP/Image files and they weren't loading.

- Osprey

I'm going to go out on a limb, and make a shot in the dark.
I'm guessing that you have your external files linked with relative links, like this:
Code:
<img src="image.jpg">
<!-- as opposed to: -->
<img src="http://www.example.com/image.jpg">

As a result, when you change the url to example.com/namehere/number, the browser is trying to look inside the /number directory for /image.jpg, which it obviously won't find.  A solution to this is to change your relative links so that they are like this:
Code:
<a href="/namehere/image.jpg">
That way the links work regardless of what directory the browser thinks that it's in, and you get to keep your relative link goodness.

As I said, I could be wrong, but I've had the above problem before, so I'm hoping I'm not the only one.  Tongue
Logged

Don't take servers for granted.
Everything is flammable, if you get it hot enough.
Visit my website!  It'll make you cooler!
Osprey
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 226

Blog entries (0)

View Profile WWW
« Reply #6 on: May 19, 2006, 05:39:55 PM »

Unfortionately io was already using the second method Neosquared, thank you though.
Logged

sixthcrusifix
Sage
Verified Account
Sr. Member
*

Karma: +0/-3
Offline Offline

Posts: 445


http://sixthcrusifix.com/home/

Blog entries (0)

View Profile WWW
« Reply #7 on: May 22, 2006, 11:18:49 PM »

Unfortionately io was already using the second method Neosquared, thank you though.
did you put a period in front like this:

<img src='./blah/blah.png'>

? I think you put a period for each folder farther away form the root.
Logged

Visite me website at http://www.sixthcrusifix.com
hypnoticvibe
Non-Verified Account
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 78


Blog entries (0)

View Profile WWW
« Reply #8 on: May 23, 2006, 03:01:32 AM »

Unfortionately io was already using the second method Neosquared, thank you though.
did you put a period in front like this:

<img src='./blah/blah.png'>

? I think you put a period for each folder farther away form the root.
The UNIX filesystem structure (which is what the server is) is set up like this:
. means the current directory
.. means one directory prior
../.. means 2 directories prior (this pattern continues)
~ means all the way back to the root directory

Even if the server was in the Windows NT family, the . and .. would still apply

I'm not exactly sure what your problem is but if the page that it redirects to works when you go straight to it but fails only through using the .htaccess file...
Why don't you use the META redirect instead?
Place this in the head of your HTML:
Code:
<meta http-equiv="Refresh" content="0;url=http://www.domainhere.com/subdirectory/page.htm">

*edit*
I should probably warn you that if you're going to get into UNIX, ~ technically means the home directory but in this case (webdesign) it will take you back to the domain name's root directory.
« Last Edit: May 26, 2006, 11:03:29 PM by hypnoticvibe » Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!