petenaylor Posted August 18, 2011 Share Posted August 18, 2011 Hi all How do I create a Mod rewrite in a htaccess file to change this url: index.php?page=about into: index/page/about Do I neave the actual URLs as they are? Many thanks Pete Quote Link to comment https://forums.phpfreaks.com/topic/245097-apache-mod-rewrite/ Share on other sites More sharing options...
trq Posted August 18, 2011 Share Posted August 18, 2011 Do I neave the actual URLs as they are? Do you mean html links to these urls? No, they would need to be changed to use the new (rewritten) url. Quote Link to comment https://forums.phpfreaks.com/topic/245097-apache-mod-rewrite/#findComment-1258944 Share on other sites More sharing options...
petenaylor Posted August 18, 2011 Author Share Posted August 18, 2011 Got ya! Do you know the correct htaccess syntax to rewrite the URL? I have tried this: Options +FollowSymLinks RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?page=$1 [L] It deosn't seem to work though? Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/245097-apache-mod-rewrite/#findComment-1258946 Share on other sites More sharing options...
trq Posted August 18, 2011 Share Posted August 18, 2011 RewriteRule ^index\/page\/([a-z]+)$ index.php?page=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/245097-apache-mod-rewrite/#findComment-1258954 Share on other sites More sharing options...
petenaylor Posted August 18, 2011 Author Share Posted August 18, 2011 Superb! Many thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/245097-apache-mod-rewrite/#findComment-1258963 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.