Jump to content
MakeWebGames

Recommended Posts

Posted

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 :)

Guest Anonymous
Posted

Re: Apache

 

RewriteEngine On
RewriteRule ^([^/]*)/$ /index.php?page=$1 [L]

 

Should work just fine :-)

Posted

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.

Guest Anonymous
Posted

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.

Guest Anonymous
Posted

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

Posted

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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...