url rewrite by htaccess problem

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

ismailctg
New php-forum User
New php-forum User
Posts: 4
Joined: Wed Mar 09, 2011 8:43 pm

url rewrite by htaccess problem

Postby ismailctg » Wed Mar 09, 2011 9:11 pm

I have not much idea about url rewrite by htaccess file. I can rewrite url for one page, but when i click in 2nd page any link it keeps 1st page folder name in url and show 404 error. Here is my code

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^page1/([a-zA-Z0-9_-]+)\.html$ page1.php?pagenum=$1
RewriteRule ^page2/([a-zA-Z0-9_-]+)\.html$ page2.php?pagenum=$1

when from any page i go to page 1, url looks like

http://localhost/page1/asad.php

But when is go 2nd page from 1st page /page1/ is no changing the url showing like

http://localhost/page1/page2/asad.php

here is my problem I need url like

http://localhost/page2/asad.php

please help me with suggestion.

Return to “HTML Basics”

Who is online

Users browsing this forum: No registered users and 0 guests