URL rewriting doesn't work

There are some pages in this format:

http://www.saglikkosesi.net/soru-ve-yanitlari-goster?page=2

I want them to appear in this format:

http://www.saglikkosesi.net/soru-ve-yanitlari-goster/page/2

I used the following code in .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteRule soru-ve-yanitlari-goster/page/(.*)/ soru-ve-yanitlari-goster?page=$1
RewriteRule soru-ve-yanitlari-goster/page/(.*) soru-ve-yanitlari-goster?page=$1 

Nothing changed. What can I do to fix this? (I use WordPress platform for my web site. But I can't use permalink feature for this redirection as this pages are external pages and I can't control them via WP admin.)

Upvotes: 0

Views: 937

Answers (2)

Milad Naseri
Milad Naseri

Reputation: 4118

Are you sure that .htaccess files are enabled by your Apache configuration?

By the way, you do that by setting AllowOverride All in the <Directory section of your httpd.conf file.

Upvotes: 1

Borodin
Borodin

Reputation: 126722

You need RewriteCond to access the query string and capture the relevant part:

RewriteCond %{QUERY_STRING} ^page=(\d+)
RewriteRule ^/soru-ve-yanitlari-goster$ soru-ve-yanitlari-goster/page/%1?

Upvotes: 0

Related Questions