aebstract Posted November 18, 2007 Share Posted November 18, 2007 Hi, I have a .htaccess file that looks like this: RewriteEngine On RewriteBase / RewriteRule ^([0-9]+)/$ /index.php?page=$1 and I have these two parts in my index.php file <div id="nav4"><a href="/home/"><img src="homexx.png" border="0" /></a></div> <?php if (!isset($page)) { echo "home"; } else { include "$page"; } ?> How come whenever I click the link, it takes me to a "404 not found" page, as opposed to the index.php page with the variable 'page' set as home? Thanks Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 anyone got a clue? I think it is close to working but something stupid is throwing it off? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 How come whenever I click the link, it takes me to a "404 not found" page, as opposed to the index.php page with the variable 'page' set as home? Probably because your mod_rewrite rule will only work if your url contains number only (eg: /01 ) instead of a string (/home) Change this line: RewriteRule ^([0-9]+)/$ /index.php?page=$1 To: RewriteRule ^([A-Z]+)$ index.php?page=$1 [NC] Also you'll want to use the following in index.php: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; switch($page) { case 'home': echo 'Homepage'; break; case 'about': echo 'About page'; break; default: $page = $_SERVER['DOCUMENT_ROOT'] . '/' . $page . '.php'; if(file_exists($page)) include "$page"; else die("$page does not exist"); break; } ?> <p>Links: <a href="home">Home</a> | <a href="about">About</a> | <a href="test">Test</a> (This page includes a file called test.php)</p> Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Okay a few things/questions: $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; whats that doing? <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; switch($page) { case '$page': include "$page"; break; if(file_exists($page)) include "$page"; else echo 'Homepage'; break; } ?> Something like that should work, right? I don't know if the error is in this or the home.php file, but I'm getting some weird text that flows half the page. www.carbenco.com take a look. Here's my home.php <?php echo \"<img src=art.png />\"; ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; whats that doing? That is an inline if/else statement. What this line does is check to see if the variable $_GET['page'] exists. If it does it'll set $page to the value of $_GET['page']. If $_GET['page'] doesn't exist then it'll set $page to home. The above line is the same as: <?php if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 'home'; } ?> <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; switch($page) { case '$page': include "$page"; break; if(file_exists($page)) include "$page"; else echo 'Homepage'; break; } ?> Something like that should work, right? Looks like all you want to do is just include a file based on $_GET['page'] ($page). If so you can scrap the switch all together and do this: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; $page_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $page . '.php'; if(file_exists($page_path)) { include $page_path; } else { die("$page_path does not exist"); } ?> I don't know if the error is in this or the home.php file, but I'm getting some weird text that flows half the page. www.carbenco.com take a look. Here's my home.php <?php echo \"<img src=art.png />\"; ?> I'm not sure about that, however this: echo \"<img src=art.png />\"; should be: echo '<img src="art.png" />'; . What happens if you change home.php to just basic text Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 It's gotta be the code in the index, cause I took the code out of home.php and it still did the same problem. Changed it to just text also, nothing. EDIT: I took out the entire php chunk of code, still doing this weird text flow. RewriteEngine On RewriteBase / RewriteRule ^([A-Z])$ index.php?page=$1 [NC] Could this have anything to do with causing the problem? Also, while we're in here, will it be possible to make that rewrite read another variable IF its set, if not then it won't bother? For instance, www.carbenco.com/print/ should read the variable page as print, but if it was www.carbenco.com/print/1/ it would read the 1 as variable work? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 I don't know then. Looks like it could be a problem with your server. As if I go to http://www.carbenco.com/home.php I get the same goblygoop I cannot see how the code in index.php affects other php files, especially if you go to them directly. Perhaps contact your webhost for support. What happens if you disable the code in the .htaccess (comment the code out add a # at the start of each line). Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 If I comment it out with the # I get an internal server error (up now). This should all work, I've had working modrewrite stuff before on this server, I just have been out of the game for a few months. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 Ugh! That shouldn't happen. Post the full contents of your .htaccess here. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 I did, look up like two posts here. You might have missed it because I posted it just before you sent in a reply. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 I don't know then it should work. There is obviously something not right. Code works perfectly fine here on my dev box. I don't get why you are getting a 500 internal server error if you have commented everything out within the .htaccess. Do you have access to your servers error logs? The cause of the Internal server error will be logged within the error log. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 I found a page that has log files, with this at the top: Nov 18, 2007 08:02 AM access_log 104 KB Would you like to look through that file? I can save it and upload it for you to look at. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 I dont thing it'll be that it should be called error.log or something like that. access_log will be log of all tcp/ip activity on your site. You might be better of contacting your webhosting company for support. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 DOH I looked down that same page a little and saw the error logs Its still a long long page or lots of stuff back to back that looks very confusing, so I will send them a ticket and see if I can get the problem solved. Thanks for your help and I'll post back here with results, whether they get the problem fixed or not. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 Normally the most recent errors are logged at the very bottom of the error log. If you post the last 10 or so lines here then I might be able to fish out the error. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 [sun Nov 18 07:37:11 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:37:11 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:39:22 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:39:23 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:39:23 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:39:43 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:40:34 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:40:38 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:41:24 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:41:25 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:41:54 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:42:04 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:42:05 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:42:50 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:43:48 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:43:48 2007] [error] [client 80.6.171.43] File does not exist: /var/www/vhosts/carbenco.com/httpdocs/home [sun Nov 18 07:43:50 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:44:02 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:10 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:10 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:46:11 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:11 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:46:11 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:11 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:46:11 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:11 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:46:55 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:55 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://www.phpfreaks.com/forums/index.php/topic,168155.0.html [sun Nov 18 07:46:55 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:46:55 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:48:04 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:48:04 2007] [alert] [client 80.6.171.43] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://www.phpfreaks.com/forums/index.php/topic,168155.0.html [sun Nov 18 07:48:07 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:48:07 2007] [alert] [client 80.6.171.43] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 07:49:51 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:49:51 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://carbenco.com/forum/index.php [sun Nov 18 07:52:12 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:52:12 2007] [alert] [client 80.6.171.43] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://www.phpfreaks.com/forums/index.php/topic,168155.msg741446/boardseen.html [sun Nov 18 07:58:34 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 07:58:34 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 08:02:13 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:02:13 2007] [alert] [client 80.6.171.43] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://www.phpfreaks.com/forums/index.php/topic,168155.msg741446/boardseen.html [sun Nov 18 08:02:50 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:02:50 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://carbenco.com/forum/index.php [sun Nov 18 08:22:50 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:22:50 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://carbenco.com/forum/index.php [sun Nov 18 08:23:34 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:34 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 08:23:36 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:36 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: Invalid command '+ACM-RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration [sun Nov 18 08:23:55 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:55 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:23:56 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:56 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:23:57 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:57 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:23:58 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:58 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:23:59 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:23:59 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:00 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:00 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:00 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:00 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:01 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:01 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:01 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:01 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:05 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:05 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [sun Nov 18 08:24:41 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. [sun Nov 18 08:24:41 2007] [alert] [client 75.117.20.99] /var/www/vhosts/carbenco.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Uhg, this makes no sense, I just took the htaccess out completely and removed the php that had to deal with that url stuff, and its leaving the garbled text flow again.. [sun Nov 18 08:33:44 2007] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 somehow my index file just now got corrupted to: +ADwAIQ-DOCTYPE html PUBLIC +ACI--//W3C//DTD XHTML 1.0 Strict//EN+ACI +ACI-http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd+ACIAPg +ADw-html xmlns+AD0AIg-http://www.w3.org/1999/xhtml+ACI xml:lang+AD0AIg-en+ACIAPg +ADw-head+AD4 +ADw-title+AD4-Carbenco Designs+ADw-/title+AD4 +ADw-link href+AD0AIg-/stylesheet.css+ACI rel+AD0AIg-stylesheet+ACI type+AD0AIg-text/css+ACI title+AD0AIg-default+ACI /+AD4 +ADw-/head+AD4 +ADw-body+AD4 +ADw-div id+AD0AIg-container+ACIAPg +ADw-div id+AD0AIg-top+ACIAPgA8-img src+AD0AIg-logo.png+ACI /+AD4APA-/div+AD4 +ADw-div id+AD0AIg-middle+ACIAPgA8-div id+AD0AIg-midleft+ACIAPgA8-img src+AD0AIg-midleft.png+ACI /+AD4APA-/div+AD4 +ADw-div id+AD0AIg-midmid+ACIAPg +ADw-div id+AD0AIg-midmidtop+ACIAPgA8-img src+AD0AIg-midtop.png+ACI /+AD4APA-/div+AD4 +ADw-div id+AD0AIg-midmidcontent+ACIAPg +ADw-div id+AD0AIg-nav+ACIAPg +ADw-div id+AD0AIg-nav1+ACIAPgA8-a href+AD0AIg-/print/+ACIAPgA8-img src+AD0AIg-print.png+ACI border+AD0AIg-0+ACI /+AD4APA-/a+AD4APA-/div+AD4 +ADw-div id+AD0AIg-nav2+ACIAPgA8-a href+AD0AIg-/indentity/+ACIAPgA8-img src+AD0AIg-identityxxx.png+ACI border+AD0AIg-0+ACI /+AD4APA-/a+AD4APA-/div+AD4 +ADw-div id+AD0AIg-nav3+ACIAPgA8-a href+AD0AIg-/web/+ACIAPgA8-img src+AD0AIg-webxxx.png+ACI border+AD0AIg-0+ACI /+AD4APA-/a+AD4APA-/div+AD4 +ADw-div id+AD0AIg-nav4+ACIAPgA8-a href+AD0AIg-/home/+ACIAPgA8-img src+AD0AIg-homexx.png+ACI border+AD0AIg-0+ACI /+AD4APA-/a+AD4APA-/div+AD4 +ADw-/div +ADw-div id+AD0AIg-mmiddle+ACIAPg +ADw-img src+AD0AIg-middle.png+ACI /+AD4 +ADw-/div+AD4 +ADw-div id+AD0AIg-art+ACIAPg hi +ADw-/div+AD4 +ADw-/div+AD4 +ADw-div id+AD0AIg-midmidbottom+ACIAPgA8-img src+AD0AIg-midbottom.png+ACI /+AD4APA-/div+AD4 +ADw-/div+AD4 +ADw-div id+AD0AIg-midright+ACIAPgA8-img src+AD0AIg-midright.png+ACI /+AD4APA-/div+AD4APA-/div+AD4 +ADw-div id+AD0AIg-bottom+ACIAPgA8-/div+AD4 +ADw-/div+AD4 +ADw-/body+AD4 +ADw-/html+AD4 What is up with that? EDIT: I went back and redid/saved everything. I think it was transfering it over to a weird style when saving so I made it save and not change a thing, its working now. Could you explain the part I was wondering about doing something like carbenco.com/home/1/ having a second variable if I wanted? Thanks for your help! EDIT2: Go to carbenco.com and look at the links, it's still bugging up. Not as bad, but a 404. So it isn't finding the variable or something? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 Use this as the .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Z]+)$ /index.php?page=$1 [NC] Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Put it in, index page loads fine, click a link and it 404's. Just so we're on the same page with the index.php file, here is what I'm using in that php section: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; $page_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $page . '.php'; if(file_exists($page_path)) { include $page_path; } else { die("$page_path does not exist"); } ?> EDIT: Okay error was in my linking, had a / on the end, which I can easily put in to the .htaccess, what about the /1/ part, adding another variable to the url, is that hard? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 Try: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Z]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([A-Z]+)/([0-9]+)/$ /index.php?page=$1&var1=$2 [NC,L] You'd use $_GET['var1'] to return whatever x is in home/x/ that also work with your other pages too. Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Hmm odd, I put that in and it's partially working. I can get it to display the variable "x". http://carbenco.com/print/60/ The box is black and the font is black, but it'll display whatever number is there. So that part is working, however, whenever I go to a page like http://carbenco.com/home/ none of the page's images show up anymore, is that something to do with the htaccess bugging it up? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 I find adding / at the start of file paths works, so instead of doing <div id="top"><img src="logo.png" /></div> do <div id="top"><img src="/logo.png" /></div> Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 18, 2007 Author Share Posted November 18, 2007 Okay that fixed that, and I think we are down to the very last problem. If you go to the website, click home and then another link.. it'll do something like this: http://carbenco.com/home/web/ which of course doesn't exist and errors. Here is the code im using to do a link: <a href="print/"> Do I need to put the entire url, like "http://www.carbenco.com/print/" ? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 18, 2007 Share Posted November 18, 2007 No you need to do that same as you did to the image paths add / infront of your links eg: <a href="/print/"> Instead of <a href="print/"> Quote Link to comment 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.