78363

apache mod_rewrite displays object not found 404

I have a link http://localhost/css/dictionary?letter=a which I want to make it like this http://localhost/css/dictionary/a

but somehow it says 404 message

Am i missing something here? this is my code in .htaccess please help me.

RewriteEngine On RewriteBase /css/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^\.]+)$ $1.php [NC] RewriteRule ^([a-zA-Z])$ dictionary?letter=$1

I've been scouring all the youtube videos and reading articles and so far im still in trouble please i need your help.

Answer1:

It's because you have 2 rules, and the first one matches first (as it is more general than the second).

The second doesn't even check for dictionary at all.

The second condition should be:

RewriteRule ^dictionary/([a-zA-Z])$ dictionary.php?letter=$1

Recommend

  • Why is my htaccess rule not rewriting the url
  • 2 Codeigniter Installations on the same server with subfolder
  • htaccess Redirect if query string variable present
  • htaccess force www to non-www with consideration of http or https
  • mod_rewrite seems to ignore [L] flag
  • Laravel 5.2 Pretty URLs
  • dyanmic url not rewriting ht access
  • Add rewrite rule
  • Remove two subdirectories from url with mod_rewrite
  • Wordpress “Post name” permalinks not working
  • .htaccess mod_rewrite Unknown number of Variables of a GET form
  • CodeIgniter and htaccess - Protect a specific controller and its methods via AuthType?
  • url rewrite not working .htaccess
  • Strip down any parameter from URL which is not whitelisted
  • Redirecting codeigniter project to https with htaccess: never complete
  • Dynamic URL rewrite using .htaccess
  • Use htaccess to mask domain and folder name
  • Codeigniter can't remove index from url
  • Too many Redirects after switching WordPress to https
  • Htaccess Public Folder Rewrite Rule
  • Direct link to a subfolder view returns 404
  • Can I used mod_rewrite to change file extensions? .jpeg to .jpg for example
  • htaccess will not rewrite subdomains
  • .htaccess rewrite: subdomain as GET parameter and filepath afterdomain intact
  • Smart URL with optional parameters?
  • How to redirect or show a page rather than “Forbidden” when i have directory listings off (htaccess/
  • .htaccess mod rewriterule and ampersands
  • Help with mod_rewrite
  • htaccess settings for angularJS pushstate
  • https in htaccess and order of rules (using Expression Engine)
  • Removing the .php file extension from the URL Request
  • Redirect to trailng slash (htaccess)
  • htaccess add www if not subdomain, if subdomain remove www
  • Magento Fatal error: Maximum execution error solution, on WAMP
  • htaccess rewriting URLs with multiple forward slashes
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal