If you rename test.php to just 'test' and then make an .htaccess file with the following:
It will work, the only trouble is that for each additional file that works like this you need to duplicate that part of the .htaccess
It depends how many files you want to handle like this really..
For two files you can do this:
And for subdirectories you can just create a .htaccess in the subdirectory in the same way.
Hope that helps!
is it possible to remove the .php through the .htaccess instead of renaming each file?
A quick search of google for 'clean url' found a few things that might be useful:
Hope that's helpful
I tried google but I can't seem to find what I mentioned in my 1st post, the links you give do work but don't add the / at the end of the url.
Best to have a read of the Article in my signature as it answers your questions.
If you use the trailing /, it can be confused as a directory request. However, mod_rewrite IS up to the task of handling either situation by adding an optional slash before the end anchor. Just be aware that EVERY subdirectory request without a file in the path will be treated this way, too! In other words, that's NOT recommended.Regards,Code:RewriteEngine on RewriteRule ^/?([a-z]+)/?$ $1.php [L]
how i can rewrite my urls to static ones.
Basically i don't know how to write regular expressions thats why i am writing down the url structure and the result i am looking for.
I want to make it:
More better if some one can give me a .htaccess file that will rewrite url to
Thanks in advance.
That's ALL in the tutorial Article linked in my signature.
Please read threads (in this thread, it's post #6) and you'll get that same advice.
I read your tutorial and used the following code in my .htaccess
RewriteRule ^search/(.*)/?$ search_results.php?search=$1 [NC,L,QSA]
But still the url is not re-written.
Can you please help.
If you'd read it, you would know to NEVER use (.*) - it's just lazy code which will backfire on you 99 times out of 100. Also, I hope that I'd stated in there that RewriteBase is ONLY to correct a Redirect problem. Saying that,Your optional trailing slash will NEVER be matched (because of the (.*)) and No Case and Query String Append flags are NOT appropriate here.Code:RewriteEngine on RewriteRule ^/?se/search/([a-z]+)/?$ se/search_results.php?search=$1 [L]
I am a beginner and i am not sure where i am making mistake.
If you mean that i put the above code:
RewriteRule ^/?se/search/([a-z]+)/?$ se/search_results.php?search=$1 [L]
in my .htaccess then i just did it but again it didn't worked.
You can see the demo of my script at:
I will be thankful for your help in solving my problem.
Sorry, my .htaccess file contains:
RewriteRule ^/?shopping_api/search/([a-z]+)/?$ shopping_api/search_results.php?search=$1 [L]
I believe that your problem stems from not having an action for your form! As a POST method, the value of the search item will be hidden from Apache (merely passed through with the POST array and not subject to review by mod_rewrite.