0

i have 2 pages

like

page1.php and page2.php

in my htaccess

1st rule is

RewriteRule ^([-a-zA-Z0-9]+)/?$ page1.php?seo=$1 [L]

2nd rule is

1st rule is

RewriteRule ^([-a-zA-Z0-9]+)/?$ page2.php?seo=$1 [L]

my rewrite rule is working perfectly for page1...but when i click a link which suppose to be redirect on page2...so it is not redirecting on that page...it redirect to page1 only....plz help

full htaccess code is

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(_assets|_css|_fonts|_includes|_scripts)($|/) - [L]
RewriteRule ^([A-Za-z-\s0-9]+)$ sub-work.php?seo=$1 [L]
RewriteRule ^([A-Za-z-\s0-9]+)$ portfolio.php?seo=$1 [L]
</IfModule>

thanks

Priyavrat
  • 5
  • 3

1 Answers1

1

Since the RewriteRule is the same for both pages, the first one is overwriting the second.

RewriteRule sub-work/([^/]+)/?$ sub-work.php?seo=$1 [L,QSA]
RewriteRule portfolio/([^/]+)/?$ portfolio.php?seo=$1 [L,QSA]

So the urls shoud look like this:

sub-work/value    
portfolio/value
wayzz
  • 585
  • 6
  • 23