Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
thara

Mod_Rewrite Is Not Working With My Urls

Recommended Posts

I am trying to make SEO friendly URLs of using apache mod_rewrite.

My normal URLs is something like this -

index.php?p=about
index.php?p=contact
index.php?p=this

My expecting SEO friendly URLs should be something similar to this -

localhost/php_advance/ch02/about
localhost/php_advance/ch02/contact
localhost/php_advance/ch02/this

I tried it with creating a .htaccess file and doing some changes to my apache httpd.conf file.

This is my .htaccess file

<ifModule mod_rewrite.c>

# Turn on the engine:
RewriteEngine on

# Set the base to this directory:
RewriteBase /php_advance/ch02/

# Redirect certain paths to index.php:
RewriteRule ^(about|contact|this|that|search)/?$ index.php?p=$1

</ifModule>

And also, At the end of the httpd.conf file, I added some code like this -

<Directory "C:/wamp/www/php_advance/ch02">
AllowOverride All
</Directory>

NOTE: I am using WAMP server and Windows 07

But this coding is not working for me. Hope someone will help me out. Thank you.

Share this post


Link to post
Share on other sites

Could you please provide some more info into how it's not working? Do you see any errors? What's not working? Where's the index.php file?

As I've mentioned many times before with mod_rewrite scripts, start with something very simple that's easy to confirm the operation of, and then slowly make things more difficult until you get what you want.

  • Upvote 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
Sign in to follow this  

×
×
  • Create New...