Hi friends

i am facing some url redirection issue in my .htaccess. please help me to fix it.

my url is


my expected URL is



Options +FollowSymlinks
RewriteEngine On

RewriteRule ^([a-zA-Z0-9-/]+).html$ article.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ article.php?url=$1

Server nginx

Recommended Answers

All 10 Replies

I believe you are missing your leading slash..
RewriteRule ^/([a-zA-Z0-9-/]+).html$ /article.php?url=$1

Also remember, do MOST specific to LEAST specific. So, your order is incorrect.

You also seem to be missing some flags that will terminate the rewrite, and you possibly have yourself stuck in a loop so apache ignores the rule.

For more info, please see:

I do recall that a few companies (godaddy) also require a few XML type markups to your .htaccess file to work as expected. You may want to look into your hosts idea of a "properly formatted" .htaccess file for mod_rewrite.

Hi ryantroop

Thanks for your reply. i tried what you suggested but its not working.

try using

RewriteRule ^(.*).html$ article.php?url=$1

for testing only and see if its working
and remove double rules for same thing.

thanks OsaMasw.

Not working

Member Avatar
RewriteEngine On
RewriteRule ^([^/]*)$ /article.php?url=$1 [L]


I am getting 404 error.

i am getting the URL as domainname/article.php?url=article.php

Hi diafol

I updated as per the link. Not working.

Member Avatar

Sorry can't help. Anybody else?


Options +FollowSymLinks -Indexes -Multiviews

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|css|js)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*).html$ /article.php?url=$1 [NC,L]


set a few options (including the all important +FollowSymLinks)

if mod_rewrite exists
Enable it
set the base to /
make sure we dont ever rewrite direct requests for images, css, or js files
or any files
or a proper directory
and then rewite our url pattern.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.