Issues with mod_rewrite

Hello,

I am trying to take a url that looks like this: huge-du.bz/testing/articles/index.php?uid=Article

And make it show as this: huge-du.bz/articles/Article

Here is my .htaccess file placed in the articles folder:

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^articles/([^/]*)/$ /index.php?uid=$1 [L] </IfModule>

For some reason it isn’t working and just shows up with the original url. Can anybody help?

Thanks!

If you have this .htaccess in the /articles/ and not in root directory, you need to change your paths in the rewrite rule to relative. Also, I would add conditions to not redirect any file or folder that exists within /articles/

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ index.php?uid=$1 [L]

Perfect :slight_smile: do I still need the tages in my .htaccess?

I just tried that code and it did not work. Is it possibly an error with my host’s software?

Sponsor our Newsletter | Privacy Policy | Terms of Service