php - Infinite redirect loop - rewriting URLs -



php - Infinite redirect loop - rewriting URLs -

i getting infinite redirect loop when implementing rewrite of urls seo purposes.

example url

`<a><?php echo make_store_name_url($store_id); ?><?php echo $store_name; ?></a>`

i have function rewrite dynamic urls - below example

function make_store_name_url($store_id) { //build keyword rich url $url = site_url . '/store/' . $store_id .'/'; //return url homecoming $url; } //function redirect using 301 function fix_store_name_url() { $proper_url = get_proper_store_name_url(); if(site_url . $_server['request_uri'] != $proper_url) { header('http/1.1 301 moved permanently'); header('location: ' . $proper_url); exit(); } } function get_proper_store_name_url() { $store_id = $_get["store"]; $proper_url = make_store_name_url($store_id); homecoming $proper_url; }

finally line in htaccess rewrite. note rewrite works fine when no redirection used.

rewriterule ^store/([0-9]+)/$ /store_selection.php?store=$1 [r=301,l]

not sure going wrong infinite redirection loop. help appreciated.

change .htaccess to:

rewriterule ^store/([0-9]+)/$ /store_selection.php?store=$1 [qsa,l]

this internally rewrites url while user still shown original. had set 301 redirect url user hitting /store_selection.php?store=id viz reason infinite loop.

php .htaccess url-rewriting seo infinite-loop

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -