I have tried several combinations (searched from google), but none are working, I also add "RewriteEngine on" to the .htaccess, just as my hosting company told me.
I have this following url:
Code:
http://submain.domain/folder of url/index.php?page=$1
$1 can stand for Home, about, contact
The .htaccess code I use is this:
Code:
RewriteEngine on
RewriteRule ^page/?$ http://submain.domain/folder of url/index.php?page=$1 [L]
Keep in mind that this ONLY covers alphabetical page names. If you include numbers or other characters it will have to be modified.
(Bonus Tip: You may want to use the QSA flag as well ([L,QSA]) if you want to automatically append query strings (i.e: http://...../page/my_page?query=string))
For more clarification on how this is done, check out this tutorial.
__________________ Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
My posts, comments, code, and suggestions reflect only my personal views.
Web Portfolio and Code Snippets: http://shanechism.com
Your phasing suggests that you might be expecting a redirect instead of a rewrite. The rewrite engine basically translates the clean URL into the dynamic URL for the purposes of the server.
Did you try navigating to the clean URL in your browser?
__________________ Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
My posts, comments, code, and suggestions reflect only my personal views.
Web Portfolio and Code Snippets: http://shanechism.com
it's kinda working now, but the only thing, is that the url is now the friendly url, when I click on a menu item I get a message that the page isn't found, the url uses part of the friendly url but with the dynamic at the end.
Do I need to change the menu urls as well, because the menu of the website (links) are not working.
Then, as I detailed more at the end of this post, you'll want to add the QSA flag.
Change [L] to [L,QSA].
__________________ Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
My posts, comments, code, and suggestions reflect only my personal views.
Web Portfolio and Code Snippets: http://shanechism.com
Well following the example we saw before you need to eliminate all of your dynamic URLs. Remember: Rewrite != Redirect.
So, this link:
Code:
<a href="index.php?page=Home">Home</a>
Needs to become this link:
Code:
<a href="page/Home">Home</a>
Keep in mind, though that this will not work with the rewrite rule I discussed earlier:
Code:
http://subdomain.domain/folder/page/Home
For that you'll need to modify ^page/([A-Za-z]*)$ to ^folder/page/([A-Za-z]*)$
__________________ Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
My posts, comments, code, and suggestions reflect only my personal views.
Web Portfolio and Code Snippets: http://shanechism.com