Jump to content

SEO URL


Recommended Posts

I am new to SEO urls and I have been reading on mod-rewrite and seo urls so I decided to implement this on my site. I am trying to rewrite http://mysite.com/index.php?page_id=1

So I created a .htaccess file and dumped it in the root of my site and add these lines

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^index/([0-9]+)\.html$ index.php?page_id=$1

But it seems that I am doing something wrong because it does not rewrite the url. Is there something that I need to add in my index.php page or is my rule wrtten wrongI have been working on this for about 8 hrs with no luck. any suggestions would be appricated.

Link to comment
Share on other sites

It doesn't change the existing URL's to new pretty URL's, it just points the pretty URL to the existing URL.

 

As for the CSS, you'll need a flag that allows real files to be exempt from the re-write. I bet your CSS URL is being re-written to the pretty URL and thus it doesn't exist.

 

Try this:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^index/([0-9]+)\.html$ index.php?page_id=$1 [L]

 

This will exclude directories and files from being re-written.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.