0

I am facing rewrite url issue.

Current website url :

testwebsite.com/dev/films.php?id=test

I want :

testwebsite.com/dev/test

I tried too many htaccess changes but it is not working.

I think below it must work

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^dev/([0-9]+)-([a-z]+)/ http://testwebsite.com/dev/films.php?id=$1 [NC]

unfortunately, i got 404 page not found.

When i removed htaccess and tried

testwebsite.com/dev/films/test

it is working. I dont have c panel access. Is there server side redirection?

I dont know what is the issue? How do i solved

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274

2 Answers2

0

You have to make sure that mod_rewrite is working on your Apache server. You can also redirect using a server-side code by sending header information to the browser before you send any HTML For example this is how you can do that in PHP.

PHP redirect

Community
  • 1
  • 1
Ariel Henryson
  • 1,316
  • 1
  • 10
  • 13
0

Here we go, set this as .htaccess file in your /dev/ directory

<IfModule mod_rewrite.c>
  RewriteEngine on
  #RewriteBase /dev/

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteCond %{REQUEST_FILENAME} !\.(css|js|jpeg|jpg|gif|png|bmp)$
  RewriteRule ^(.*)$ index.php?id=$1 [L,B,QSA]
</IfModule>

May require uncomment of RewriteBase based on your server setup

zr9
  • 516
  • 1
  • 4
  • 13