PHP - Moved: Mod-rewrite Rule For Custom Urls (/userprofile.php?userid=1001 To /example)
This topic has been moved to mod_rewrite.
http://www.phpfreaks.com/forums/index.php?topic=315930.0 Similar TutorialsThis topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357227.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=318793.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=329079.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=326189.0 Say my URL is http://www.example.com/catalog.php?category=hats&prodID=53 and I use Mod-rewrite to make it http://www.example.com/catalog/hats/53/ Can I still use $_GET['category'] to get the parameters? If so, how? Hi all
I have the following in my .htaccess file
RewriteRule ^([^/]+)/ /$1.php?q=$1 [L,QSA]
and this is great because any PHP page I create, such as 'about.php' can be rewritten as '/about/' - so that is all good.
the problem is, I also want to let users create their own custom URL's for their profiles in the root of the site, such as '/david-jones/' but because 'david-jones' is not actually a real PHP page (but rather a database entry), I cant use a rewrite rule as far as I can see.
Would the best solution be to piggy back the error 404 rewrite rule, so that if an actual PHP page isn't found, it takes them to the 404 error page which actually contains a script to lookup the users details, if the user details are not found, i'd show a "the page cannot be found" message.
Or is there a more elegant way to do this?
Thanks
Hello, I have to do repetative search tasks over 3 websites. To make mylife easier (and for the fun of programming this), i'm trying to create the below: [text input box] link1 (checkbox) link2 (checkbox) link3 (checkbox) [submit button] I would like each checkbox to represent a custom URL, which (when checked) will then enter the search 'term' from the input textbox and open the generated URL in a new window. For example my 3 URLS will look like the below. I need to replace the search term ('my search term' in this example) and add the "+" symbol for each word. h.ttp://www.google.com/search?num=100&hl=en&tbs=nws:1,sbd:1&q=my+search+term&aq=f&aqi=&aql=&oq=&gs_rfai= h.ttp://search.ft.com/search?ftsearchType=type_news&sortBy=gadatetimearticle&queryText=my+search+term h.ttp://www.reuters.com/search?blob=my+search+term Would anyone have some code snippets in order to get me started? I'm new to PHP and custom forms, but can 'read' code rather well as I have previous coding experiences. Any help at all would be hugely appreciated! I have a list names in a database table in MySQL that I need to repeat the same search for on my system to get the associated information. Is there a Loop command or some type of trick to making a php script search table1.row1 then table1.row2 then table1.row3 etc. Basically using the row in the table as a variable for the other commands in the code. I really need some direction. Thanks. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357919.0 This topic has been moved very early in the morning to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359281.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=318852.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325762.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=332483.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=333344.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346275.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=321165.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=349451.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=314170.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=314375.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325281.0 |