SuperMAG Posted December 29, 2012 Share Posted December 29, 2012 Suppose i have custom pages like http://www.myfootballcafe.com/page/5/football-fixtures-results-tables/ or http://www.myfootballcafe.com/page/6/contact-us/ I want to remove the page/6/, i want to make it look like this: http://www.myfootballcafe.com/football-fixtures-results-tables/ or http://www.myfootballcafe.com/contact-us/ I checked few examples, but the code was a bit complicated for me to understand. I know you have to make some sort of rule in the mod rewrite. Any help will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/ Share on other sites More sharing options...
Christian F. Posted December 29, 2012 Share Posted December 29, 2012 How would the server know which page to display then? Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402043 Share on other sites More sharing options...
SuperMAG Posted December 30, 2012 Author Share Posted December 30, 2012 mmm, well lol i donno. can i do this page per page. like a code for every page link, i also want to redirect the old pages to new ones. Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402155 Share on other sites More sharing options...
cpd Posted December 30, 2012 Share Posted December 30, 2012 Most mod_rewrite applications just redirect to a single page which interprets the URL. There's usually a format such as http://website.com/module/controller/action/arg1/arg2/ but it varies from app to app. The application works out the correct content to show and the MVC architecture apps usually use a Router class. Why is this relevant to you? Because I think, you think all the leg work is done in htaccess when in reality its not. More permanent things could be done in htaccess such as a 301 redirect. Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402253 Share on other sites More sharing options...
SuperMAG Posted December 31, 2012 Author Share Posted December 31, 2012 well i would like to avoid having 10/15 folders with index.php inside it on the main website. thats all. i know about redirect through htaccess, as it can be done from my cpanel too. Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402337 Share on other sites More sharing options...
cpd Posted December 31, 2012 Share Posted December 31, 2012 What's the purpose of your 10/15 index.php files? Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402378 Share on other sites More sharing options...
SuperMAG Posted January 1, 2013 Author Share Posted January 1, 2013 well the other way is that i create a folder and name it as /contact-us/, then put it main public html, i have to do that with all other pages. Quote Link to comment https://forums.phpfreaks.com/topic/272490-need-a-bit-of-help-with-mod-rewrite-in-htaccess/#findComment-1402523 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.