Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support htaccess
Calamity
Posted on 16 Jul 2009, 21:06:32

Access: Member
Total Posts: 33
Joined: 2008-04-11

I'm having tons of issues!
Code:
Options +FollowSymLinks -MultiViews
DirectoryIndex index.php
RewriteEngine on 
RewriteRule ^(.*)/$ /$1.php [L]
RewriteRule ^recent/([0-9]+)$ recent.php?page=$1
RewriteRule ^recent recent.php [L]    
RewriteRule ^([0-9]+)$ paste.php?id=$1
RewriteRule ^home index.php
RewriteRule ^login login.php
RewriteRule ^changepass changepassword.php
RewriteRule ^activate activate.php
RewriteRule ^lostpass lostpassword.php
RewriteRule ^logout logout.php
RewriteRule ^register register.php
RewriteRule ^todo todo.php
RewriteRule ^cpanel cpanel.php           
RewriteRule ^lock=([0-9]+)$ lock.php?id=$1
RewriteRule ^unlock=([0-9]+)$ unlock.php?id=$1
RewriteRule ^delete=([0-9]+)$ delete.php?id=$1    
RewriteRule ^([a-zA-Z]+)$ user.php?user=$1


It works somewhat how i want it to.
relative paths don't work.
I have domain.com/recent/1

And any relative paths don't work.
#633
Chris
Posted on 17 Jul 2009, 02:17:10

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

...
#636
Calamity
Posted on 17 Jul 2009, 03:17:29

Access: Member
Total Posts: 33
Joined: 2008-04-11

(Sorry about the whole topic, had nothing to do with n13, but its a help and support forum =/, sorry)

Nvm i'm not going to deal with relatives..

I knew why they didn't work, i just wanted to know if there was a simple way to make it, that way i didn't have to go and change all my relative links.

But i had created a new design anyhow. So i decided to just say screw it.
(http://lifestream-studios.com/projects/v3/)

Anyhow.. I was dealing with trailing slashes.. And i don't think i did it properly.

It works and all, just doesn't seem like i did it correctly.
Seemed to be the only thing that would allow me to do: /recent/2/ and actually work.

=/
Code:
Options -MultiViews +FollowSymLinks 
DirectoryIndex index.php
RewriteEngine on    
RewriteRule ^(.*)/$ /$1 [L]      
RewriteRule ^recent/([0-9]+)$/? recent.php?page=$1 
RewriteRule ^recent$ recent.php 
RewriteRule ^home$ index.php       
RewriteRule ^([0-9]+)$ paste.php?id=$1
RewriteRule ^login$ login.php
RewriteRule ^changepass$ changepassword.php
RewriteRule ^activate$ activate.php
RewriteRule ^lostpass$ lostpassword.php
RewriteRule ^logout$ logout.php
RewriteRule ^register$ register.php
RewriteRule ^todo$ todo.php
RewriteRule ^cpanel$ cpanel.php           
RewriteRule ^lock=([0-9]+)$ lock.php?id=$1
RewriteRule ^unlock=([0-9]+)$ unlock.php?id=$1
RewriteRule ^delete=([0-9]+)$ delete.php?id=$1 
RewriteRule ^([a-zA-Z]+)$ user.php?user=$1


Chris you think you could show me how you did it (like this site)?


And why don't you get on msn anymore chris.. I've actually missed talking to you, you were fun to talk to (no homo)

I've gotten alot better with php and css then from the last time we talked.
I was reading a convo from back when i first started talking to you. Wow i probably annoyed the crap out of you.

I pratically asked you to do the work for me O_O, sorry bout that man.

Oh and chris. Man IE sucks, i use to love it, wow, you were so right on how bad it is compared to other browsers..
Kurisu Says:
"everyone is used to IE, its only when you switch and find out everything thats amazing about firefox you realise how crap IE is"

Well i didn't switch to firefox, i use chrome, but still O_O, sorry got off topic. Just wanted to get that out haha
#637
Last edited by Calamity at 2009-07-17 03:41:58 Reason:
Chris
Posted on 17 Jul 2009, 04:04:51

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

You're over complicating things. Here's a similar method I've used on network-13.

The .htaccess file contains code simliar to this

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

This basically means that any url you enter, as long as it's not a real file, it will pass the url to index.php

Then the code for index.php you can do something like this

Code:
<?php
#grab the url that .htaccess has passed to it
$url = $_SERVER['REQUEST_URI'];

#break up the slashes, example, network-13.com/newthread/1111111111
$urlparts = explode("/",$url);

#in this example 
#$urlparts['0'] = 
#$urlparts['1'] = newthread
#$urlparts['2'] = 1111111111

#now you can start showing different content depending on which variables have been passed via the url

if($urlparts['1'] == "register"){
    
register stuff here
}elseif($urlparts['1'] == "login"){
    
login stuff here
}elseif($urlparts['1'] == "profile"){
    
#example - http://network-13.com/profile/Chris
    
$user = $urlparts['2'];
    
#$urlparts['2'] is the username, so you'd check if that user exists then show the profile
}
?>
#638
Last edited by Chris at 2009-07-17 05:54:53 Reason:
Calamity
Posted on 17 Jul 2009, 17:59:27

Access: Member
Total Posts: 33
Joined: 2008-04-11

Thanks chris!
For some reason using
Code:
$_SERVER[REQUEST_URI]
didn't work.
Maybe something to do with me using linux? idk.

But i googled around, and found this. And this worked!!
Code:
$GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"];


with that, using
Code:
$urlparts[0]

only shows nothing, rather then like lifestream-studios.com
Or in your case network-13.com

But thanks!
#642
Last edited by Calamity at 2009-07-17 18:32:29 Reason:
Calamity
Posted on 17 Jul 2009, 22:38:17

Access: Member
Total Posts: 33
Joined: 2008-04-11

Now, How would i make a unique <title></title>
For each page. =/

#656
Last edited by Calamity at 2009-07-24 01:06:58 Reason:
Chris
Posted on 17 Jul 2009, 23:44:14

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

The same way you show your content.

Code:
<title>
<?php
if($urlparts['1'] == "login"){
    echo 
"Login";
}
?>
</title>
#657
Network-13.com © 2013