.htaccess - Rewrite with htaccess -
here i'm trying do. i've got these urls, old form , new form
site.com/video.php -> site.com/video site.com/index.php?cat_id=1 -> site.com/some-cat-name
here htaccess file working if 1 of last 2 commented.
options +followsymlinks rewriteengine on rewritebase / rewriterule ^\.htaccess$ - [f] rewritecond $1 !^(index\.php|img|js|css|admin|robots\.txt) rewriterule ^video$ /videos.php/$1 [l] #rewriterule ^(.*)$ /index.php/$1 [l]
if 2 active server returns error 500
rewriterule ^video$ /videos.php/$1 [l] rewriterule ^(.*)$ /index.php/$1 [l]
my logic if first matched video in url redirect videos.php , forget under line, seems in other way. can 1 explain how have predifined urls , others go on index.php, tnx in advanced.
you getting 500 (internal server error) because rule looping in rule:
rewriterule ^(.*)$ /index.php/$1 [l]
to fix rule have .htaccess this:
options +followsymlinks rewriteengine on rewritebase / rewriterule ^\.htaccess$ - [f] rewritecond %{request_filename} !-f rewritecond $1 !^(index\.php|img|js|css|admin|robots\.txt) rewriterule ^video$ /videos.php/$1 [l] # ignore existing files , directories rewrite rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php/$1 [l]
Comments
Post a Comment