im seeking for help with htaccess. i have this url, which i want to solve by removing the .php in the url and have it like a directory. can anyone help me?
Here is what the URL looks like:
http://localhost/test/archive.php
Here is what i want the URL to be:
http://localhost/test/archive
i have heard that .htaccess is the only way to solve it. can any of you guys can help me? thanks in advance.
g1smd
6:32 am on Oct 12, 2011 (gmt 0)
This question is asked almost every day here.
On the pages of your site, link to the URL you want users to see and use.
Install a RewriteRule to rewrite requests for the URL example.com/test/archive to the internal filepath /test/archive.php.
Before that, install another RewriteRule to redirect external requests for the URL example.com/test/archive.php to the new URL at example.com/test/archive. This rule will also need a preceding RewriteCond looking at %{THE_REQUEST} to ensure that there is not an infinite rewrite-redirect loop.
There's more than 5000 previous threads with example code in this forum, at least five already so far just this month.
maryjiel
6:58 am on Oct 12, 2011 (gmt 0)
do you have any good example that can serve me as a reference. i am not yet familiar using htaccess and i want to see how it works.
g1smd
7:06 am on Oct 12, 2011 (gmt 0)
Pick a few threads from this list: [google.com...]
It will not take more than a few random clicks to find a question similar to yours with example code to adapt and try.
You've already got a clue what the code will look like. All you need to do is fill in the right RegEx patterns.
maryjiel
7:23 am on Oct 12, 2011 (gmt 0)
ok. before that tell me first if this is right. i got this from 9lessons.info showing the URL: