Reputation: 1544
I am trying to write custom URL for 2 parameters
http://localhost/htaccess/site-list-pune-pune/xcxc
htaccess is my application fordername
but i get this error "Object not found!"
may be i missing in last rule please help me
here is my code :
#Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:\+|%20|\s)+(.+?)\sHTTP [NC]
RewriteRule ^ /%1-%2 [L,NE,R=302]
# To externally redirect /dir/foo.php?name=123 to /dir/foo
RewriteCond %{THE_REQUEST} ^GET\s(.*)/single-page\.php\?name=([^&\s]+)&dd=([^&\s]+) [NC]
RewriteRule ^ %1/%2/%3? [R,L]
# /htaccess/Movie.php?name=movie-name => /htaccess/movie-name
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\.php\?name=([^&\s]+)&dd=([^&\s]+) [NC]
RewriteRule ^ %1/%2/%2? [R,L]
# To internally forward /dir/foo/12 to /dir/foo.php?name=12
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/([^/]+)/?$ $1.php?name=$2&dd=([^&\s]+) [L,QSA]
# handle /htaccess/movie-name internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ single-page.php?name=$1&dd=([^&\s]+) [L,QSA]
internal url : http://localhost/htaccess/single-page.php?name=pune-site-list-pune&dd=xcxc
Upvotes: 1
Views: 95
Reputation: 784938
Replace your last rule by this rule:
# handle /htaccess/movie-name internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ single-page.php?name=$1&dd=$2 [L,QSA]
([^&\s]+)
cannot be used in replacement as this this regex to capture values in RewriteCond
.
Upvotes: 1