Undefined
Undefined

Reputation: 764

htaccess doesnt work on mobile browsers

I have my htaccess code for rewrite rules like this:

RewriteEngine On
RewriteRule ^([0-9_-]+)/?$ index.php?id=$1 [L]
RewriteRule ^([a-z-]+)/?$ search.php?q=$1 [L]
RewriteCond %{THE_REQUEST} \ /search(?:\.php|)\?q=([^\ &]+)
RewriteRule ^ /%1? [L,R]

On the pc browser it works well. If the user types in search "word" it will look like this:

www.name.com/word

And it works just fine, but when it comes to mobile browser I tested out (Samsung s6 phone) the link shows up as 404 page.. Why it doesnt work on the mobile? Do I need some extra code in htaccess file?

Upvotes: 0

Views: 596

Answers (1)

Croises
Croises

Reputation: 18671

If it's a problem with upper / lower case, try:

RewriteEngine On
RewriteRule ^([0-9_-]+)/?$ index.php?id=$1 [L]
RewriteRule ^([a-z-]+)/?$ search.php?q=$1 [NC,L]
RewriteCond %{THE_REQUEST} \ /search(?:\.php|)\?q=([^\ &]+)
RewriteRule ^ /%1? [L,R]

Upvotes: 1

Related Questions