POG1 Posted January 30, 2009 Share Posted January 30, 2009 I am making a website and i have tried to use apache to create SEO friendly urls (so like domain,com/about) and i have read a few tutorials but have had little luck. Basically i have a single index file and the contents of the pages are included from another folder, i dunno where i am going wrong but it's not working as i'd hoped. Here is the code i have managed to "bodge" together and it's not displaying images as well as not displaying content. RewriteEngine On RewriteCond %{REQUEST_URI} !^/about/.* RewriteCond %{REQUEST_URI} !^/index/.* RewriteRule ^index.php(/.*)$ /index.php?page=$1 [L] Can someone please help me :) Quote Link to comment Share on other sites More sharing options...
Lithium Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache Options +FollowSymlinks RewriteEngine on RewriteRule ^([0-9]+)-([a-z]+) http://domain.com/index.php?page=$1 [NC] Try this one Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache RewriteEngine On RewriteRule ^([^/]*)/$ /index.php?page=$1 [L] Should work just fine :-) Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 30, 2009 Author Share Posted January 30, 2009 Re: Apache none of them worked. The code i posted did work but it wouldn't get images or includes from an extra folder.. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache -- Edit wrong post. Quote Link to comment Share on other sites More sharing options...
Lithium Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache probably the images need to point as they were also rewritten to point to the right place... though... i just don't know :| Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 30, 2009 Author Share Posted January 30, 2009 Re: Apache Did you add the forward slash? unless you don't want it, use... RewriteEngine On RewriteRule ^([^/]*)$ /index.php?page=$1 [L] If i copy and paste that i get an "Internal Server Error" I haven't got a clue when it comes to apache. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache Ah, just re-read your post. I'm personally not sure how'd you could display images without including the url to the path of the image. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted January 30, 2009 Share Posted January 30, 2009 Re: Apache Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule (.*) index.php?page=$1 [QSA,L] Dump the contents of $_GET and $_SERVER to see what to do next. The !-f construct ensures that if the file does NOT exist, it is sent through to the next line ... ie index.php Taken from Building-Search-Engine-Friendly-Sites Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 31, 2009 Author Share Posted January 31, 2009 Re: Apache Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule (.*) index.php?page=$1 [QSA,L] Dump the contents of $_GET and $_SERVER to see what to do next. The !-f construct ensures that if the file does NOT exist, it is sent through to the next line ... ie index.php Taken from Building-Search-Engine-Friendly-Sites thanks. worked a treat :) 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.