Link Posted August 3, 2007 Share Posted August 3, 2007 I want www.domain.com/ABC123 to redirect or represent they page www.domain.com/dir/page.php?ec=ABC123 Is that a .htaccess mod or something else? If so, what's the code? Anyone know? Quote Link to comment Share on other sites More sharing options...
shen Posted August 3, 2007 Share Posted August 3, 2007 Try this .htaccess file Options +FollowSymLinks <IfModule mod_php4.c> php_value session.use_trans_sid 0 php_value register_globals 1 php_value display_errors 1 </IfModule> RewriteEngine On RewriteBase /httpdocs/ // here given your uri path after given remove this comment from htaccess file RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/(.*)/$ www.domain.com/dir/page.php?ec==$1 Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Got an "Internal Server Error" message. Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Just kidding, got the 404. Do I change /httpdocs/ to /home/site/public_html? Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted August 3, 2007 Share Posted August 3, 2007 I'm not sure but try this.. add this code to your .htaccess file Redirect 301 /dir/page.php(\?[a-z]\=[A-Z0-9]) /dir/page.php/ Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 DeadEvil, didn't work. Quote Link to comment Share on other sites More sharing options...
shen Posted August 3, 2007 Share Posted August 3, 2007 Do I change /httpdocs/ to /home/site/public_html? -- Try this, if not correct then, is it a root directory then simply put / only. Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Nope. Sorry Shen...anything else? domain.com/var -> domain.com/dir/page.php?ec=var Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 ok, so this kinda worked: RewriteEngine on RewriteRule ^(.*) /home/eventron/public_html/events/index.php?ec=$1 But it messes up the includes and such in index.php. Quote Link to comment Share on other sites More sharing options...
shen Posted August 3, 2007 Share Posted August 3, 2007 ok. just remove this two line from the following code. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d . and try it. Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted August 3, 2007 Share Posted August 3, 2007 I use RewriteEngine.. RewriteEngine On RewriteRule ^dir/page.php([A-C1-3])/?$ dir/page.php?ec=$1 [L] Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted August 3, 2007 Share Posted August 3, 2007 error in my previews code RewriteEngine On RewriteRule ^dir/([A-C1-3])/?$ dir/page.php?ec=$1 [L] Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Shen, if I remove those lines, I get a page does not exist error. DeadEvil, neither worked. RewriteEngine on RewriteRule ^(.*) /home/eventron/public_html/events/index.php?ec=$1 The above brings up the index.php, but the files that are included in index.php aren't displaying properly probably because of directories and such. Is there a way to forward to that address above rather than just displaying it through www.eventron.com/$1 ? Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Actually, that makes the whole site skiddish, adding the above code. It messes up a lot of the coding for some reason. Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 And, this made things a bit better: RewriteEngine on RewriteRule [.*]eventron.com/(.*)^[.html|.php|.inc.php] /home/eventron/public_html/events/index.php?ec=$1 which doesn't mess up other files, but it still gives me a page does not exist at www.eventron.com/abc123 Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted August 3, 2007 Share Posted August 3, 2007 Last try.. RewriteEngine On RewriteRule ^dir/([A-Za-z0-9-]+)/?$ dir/page.php?ec=$1 [L] Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 Sorry DeadEvil, but stick with me for just a second: RewriteEngine on RewriteRule ^([A-Za-z0-9]{6}) /home/eventron/public_html/events/index.php?ec=$1 That sets $ec = events....any clue why? I want to check for a six character string that's not a file at www.eventron.com/STRING and then set that string to $ec in /events/index.php. It can use redirect or whatever it needs to... Quote Link to comment Share on other sites More sharing options...
Link Posted August 3, 2007 Author Share Posted August 3, 2007 GOT IT (actually) RewriteEngine on RewriteRule ^([A-Za-z0-9]{6})$ /home/eventron/public_html/events/index.php?ec=$1 Not sure why...wanna take a stab at explaining? I understand Reg Ex, but I'm not sure why that worked here! Quote Link to comment Share on other sites More sharing options...
Danltn Posted August 3, 2007 Share Posted August 3, 2007 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /dir/page.php?ec==$1 // Edit this line 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.