0

I want to do something like this:

domain.com/movie.php?mno=abc

I don't want this to be seen by the user.
Instead of this, I want to display:

domain.com/movie/abc

I am working in php, so can anyone please help me with it?
I have used .htaccess and tried many different code in it, but I don't get my desired output.

AddType text/x-component .htc
RewriteEngine On
RewriteBase /
 # remove .php; use THE_REQUEST to prevent infinite loops
 RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
 RewriteRule (.*)\.php$ $1 [R=301]
 # remove index
 RewriteRule (.*)/index$ $1/ [R=301]
 # remove slash if not directory
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_URI} /$
 RewriteRule (.*)/ $1 [R=301]
 # add .php to access file, but don't redirect
 RewriteCond %{REQUEST_FILENAME}.php -f
 RewriteCond %{REQUEST_URI} !/$
 RewriteRule (.*) $1\.php [L] 
 RewriteRule ^movie/(\d+)*$ ./moviedownload.php?mno=$1 [NC,L]
almightyGOSU
  • 3,731
  • 6
  • 31
  • 41
  • I would suggest looking at something like this http://code.tutsplus.com/tutorials/using-htaccess-files-for-pretty-urls--net-6049 – pcnate May 30 '15 at 07:19

1 Answers1

1

You have alot of things going on in that file. You should use some conditions if they are acting on different things.

As for what you asked in the question, try this:

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^movie/(\d+)*$ ./movie.php?mno=$1
pcnate
  • 1,694
  • 1
  • 18
  • 34