Amar Prem
Amar Prem

Reputation: 289

htaccess showing error when I try to open page

I have two page and I'm trying to make good looking url for these links. First link :-

http://www.themobilesapp.com/tags.php?tag=Android

for to convert this url into this url.

http://www.themobilesapp.com/tag/Android

for this i write this code.

RewriteRule ^tag/([A-Za-z0-9-]+)?$ tags.php?tag=$1 [L]

Second link :-

http://www.themobilesapp.com/phones.php?title=Apple

for to convert this url into this url.

http://www.themobilesapp.com/brand/Android

for this i write this code.

RewriteRule ^brand/([A-Za-z0-9-]+)?$ phones.php?title=$1 [L]

But on both pages one same error is coming. This error is coming on my page Internal Server Error

and my whole htaccess file code is

Options +FollowSymLinks -MultiViews -Indexes
Options -Multiviews

<IfModule mod_rewrite.c>

DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

ErrorDocument 404 404error.php

RewriteRule ^([A-Za-z0-9-]+)?$ specification.php?url=$1 [L]

RewriteRule ^news/([A-Za-z0-9-]+)?$ news.php?url=$1 [L]

RewriteRule ^social/([A-Za-z0-9-]+)?$ social.php?url=$1 [L]

RewriteRule ^tag/([A-Za-z0-9-]+)?$ tags.php?tag=$1  [L]

RewriteRule ^brand/([A-Za-z0-9-]+)?$ phones.php?title=$1  [L]

</IfModule>

All RewriteRule rules are working except below two.

Upvotes: 3

Views: 129

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Please check for spellings and make sure file exist, try to use below simplified rule.

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

#after above rewrite cond use below rewrite for each page in below manner
RewriteRule ^tags/([\w-]+)$ tags.php?tag=$1 [L]

Upvotes: 2

Related Questions