PHP - Htaccess Mod Rewrite Works For Some Not Others
I was trying to refrain from posting, but its driving me mad and I am not sure what to do.
Here is the issue.
I have some rewrite rules and are making them better. But for now just need to know why this rule is giving me a page not found everytime.
Firstly, this rule works fine:
Options +FollowSymLinks
Similar TutorialsHello everyone,How can i change the url when I am navigating from one page to another. for example if the existing url is like "www.example.com/product.php?name=xyz&q=service" ,I want to change it to "www.example.com/product/name/xyz/q/service" But I dont want to use .htacces. How can I do it using php functions only? Hi Guys, I no its only a partial PHP question but its still related to PHP... I have a URL .com/sites/0.php?Ter=144 and it takes you to a page and loads details with the id (ter) equalling 144 and displays all of 144's information... normal PHP stuff However I want to be able to put a Rewrite rule using a .htaccess (unless there is a better method!?) to get search engine frienly results. However I dont want the user to type .com/144 to bring up the Leeds branch. I want them to type .com/leeds and it bring up 144 (Leeds Branch). BranchName is the field I use for the branch name in my MySQL table. Is this possible? Also when I enter .com/sites/0.php?BranchName=Leeds that doesnt work either... Cheers, Sam This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=349451.0 Hi,
can anyone tell me what im doing wrong. below is a rewrite rule saved as .htaccess. the page loads and i dont get a 500 error but the url didnt change like it should have in the rewrite rule. The .htaccess is located in the root folder. Any idea what i'm doing wrong guys? <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^products/$ view/inventory.php </IfModule> This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325281.0 Hello, I'm learning how to write simple CMS and I'd like it to support page aliases. So that instead of http://www.myweb.com/?id=123 I could use http://www.myweb.com/some-page for example. I don't want to use rewrite rules in .htaccess but I'd like to do it similarly as Drupal. I understood Drupal redirects 404 page not found error to index.php and then somehow handles it. Can you advise how to do it please? Or is there any tutorial or example available? Thank you in advance! Vojta Seems to be a popular topic here - rewriting urls to have slashes instead of ?'s and ='s...
Fortunately, my rewrite is working, but php is displaying the wrong string, and I can't figure out why.
My .htaccess is:
Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^file/(.*)$ ./file.php?str=$1 [L]Going to something like example.com/file/anythinghere/ works but php says the $_GET['str'] is anythinghere.php/anythinghere and that's not right. In a case like that, I just need "anythinghere" Is my htaccess wrong? There is nothing in my php code that is manipulating the string to do this. If I go to example.com/file.php?str=anythinghere "anythinghere" is displayed solo Edited by idkwhy, 16 September 2014 - 08:48 PM. This one requires lots of up front information: I have a page, for this example that I will call page.php. It takes get parameters, and for this example I'll call the parameter "step". So I have a URL like this: page.php?step=1 This page has a form with an action of page.php?step=1. The code on the page validates the posting information. If the information is bad, it returns the user to page.php?step=1; if it is good, it takes the user to page.php?step=2 via header( "location:page.php?step=2" ). So redirection is done by relative path, not full URLs. This all works as expected. Now what I've done is set .htaccess to be HTTPS for this page, via this code: # Turn SSL on for payments RewriteCond %{HTTPS} off RewriteCond %{SCRIPT_FILENAME} \/page\.php [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] This works (initially). However, once you try to post the form, it just redirects back to the step=1 version of the page. I really don't know how or why that would be. I'm not sure how else I can explain this or what other information you may have. But it's frustrating to not get a page working in HTTPS that works in HTTP. Very odd. Any suggestions? (I don't even really know the best location to figure out when/why it's redirecting back to the original page.) I want to rewrite this url
site.come/info.php?country=america&state=colorado&city=denver I am having trouble rewriting a url, I have taken on a project that to rebuild a site that is over 7 years old and the current url structure is "http://www.mysite.com/?page=home" this i find crazy who uses "?page=" anyway am now creating the site again using a better structure of http://www.mysite.com/home.htm my problem is that the owner of the site has good google results with the current urls but wants them changing, and for the old ones to work too, i am trying to do this with .htaccess but the "?" in the url is causing massive problems with internal server errors. can anyone help me please it driving me nuts. Thanks in advance hello friends, that would help me alot , if i've 2 code all are of if and else code 1 $r = $_SERVER['HTTP_REFERER']; if (stripos($r, $refere) !== false) { echo "good"; }else{ echo "bad"; } code 2 if($line[hits] >= $limited){ echo "bad"; }else{ echo "good"; } both are 2 codes where the user should pass before it show good how then it be 1 code not 2 ( if x if y else y2 else x2 ) it like double sandwich 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
Hi,
I have upgraded my server from PHP 5.3.3 to version 5.5 and I'm now having a few problems with some code.
This line gives a fatal error of:
Call to undefined function session_is_registered()
if (session_is_registered("isAuthenticated") && ($_SESSION ['isAuthenticated'] = "loggedIn"))It appears this is depreciated? How can I solve this? This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357919.0 Hi, I've a problem modifying the code which send parallel requests to get the status from getstatuses().I've two functions say public function getStatuses($idList) { } public function getid($id) { $status = array(); foreach ($id as $idList) { $status[] = $this->getStatuses($idList); } return $status; } the above getid() function sends the synchronous requests to the getstatuses() function and get the status back one after another.If you need to make 5 HTTP requests and each call takes a second, your app is delayed at least 5 seconds.Now,i want to rewrite the code(if possible two functions)that speeds up the results by sending all the requests and getting back the statuses at once.Something,other friends have developed is to reverse the getstatuses() and getid() functionality.Can anybody help me writing this code Thanks 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=333344.0 Hello friends, If i've link as following myownsite.000/index.php?r=5774 and i want to convert it to be myownsite.000/5774 i've tried .htaccess Code: [Select] RewriteRule (.*)\ index.php?r=$1 but didn't worked ! can anyone write it thanks mod rewrite on easy php: EasyPHP says to set the following in apache config : http://www.easyphp.org/faq.php#0 Quote Uncomment LoadModule rewrite_module modules/mod_rewrite.so In <Directory "${path}/www"> section replace AllowOverride None by AllowOverride All I have done as the guide requested on easyPHP and restarted the easyPHP. writing a modrewite into the .htaccess following this guide: http://www.debian-administration.org/articles/136 Resulted in a .htaccess like so: Code: [Select] RewriteEngine on RewriteRule ^/route/([A-Za-z0-9]+)$ /?route=$1 [PT] With this all in place and the url of the easyPHP index page is: http: //127.0.0.1:8080/testsite/ I added a link on the home page like this: http: //127.0.0.1:8080/testsite/route/hello but the link doesnt work. the .htaccess isn't kicking in it seems. Is it not meant to be seen in the php as: http: //127.0.0.1:8080/testsite/?route=hello So that i can grab the route from the $_GET? This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=332483.0 |