zeeba42 Posted May 7, 2013 Share Posted May 7, 2013 I have remade my company webpage using very little php mostly because I don't know it however the last web designer seemed to love it and now all the links that are out in the big www start with "?p=" and I can't do a 301 redirect on those pages. how do I rewrite those links as they are coming in to change ?p=page to page/php so I can properly redirect them in my htaccess file. Redirect 301 /?p=oldpage http://www.mypage.com/newpage.php/ won't redirectRedirect 301 /oldpage.php http://www.mypage.com/newpage.php/ will redirect I found this in his index.php file and I think thats what he used to change the .php to ?p= $page = (isset($_GET['p']) ? $_GET['p'] : $homePage);$page = basename($page);$page = str_replace(".php","",$page);if(!file_exists($page . '.php')){$page = $errorPage; Link to comment Share on other sites More sharing options...
justsomeguy Posted May 7, 2013 Share Posted May 7, 2013 The browser still gets the index.php page, when you request a directory name instead of a filename (e.g. www.google.com/ instead of www.google.com/index.pl) then the web server looks for an index page in that directory and uses that, so it's running the index.php. He just has it set up to look for the querystring variable and include another PHP file based on that value. There's an answer to your other question here: http://www.simonecarletti.com/blog/2009/01/apache-query-string-redirects/ Link to comment Share on other sites More sharing options...
m_k_amin Posted May 16, 2013 Share Posted May 16, 2013 Find a practical example about htaccess here: Article Manager with Direct Links Using htaccessI think you can do it for your company as well. Hope to be useful. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now