• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

WAMP automatically adds .php extension to file with RewriteRule  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to rewrite my url with apache .htaccess (rewriting) as following:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)/?$ index.php?url=$1 [QSA,L]


My small project structure is:

.htaccess
index.php
test.php


Everything works fine, whatever I type after the "/" is in my $_GET["url"] variable. But as soon as I type in domain.com/index, it somehow automatically adds the .php extension to my url and leaves my $_GET["url"] empty. Same story when I try domain.com/test: it goes to test.php instead of rewriting to domain.com/url=test.

The strangest thing is that on 000webhost.com it all works perfectly! When I upload the same file(s), its shows up the index and test in my $_GET["url"] variable.

Hope someone can help me!
Gratz
 
Sheriff
Posts: 11604
178
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question was cross-posted on StackOverflow.
 
Barry Deman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:This question was cross-posted on StackOverflow.



Is that not allowed?
 
Roel De Nijs
Sheriff
Posts: 11604
178
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Barry Deman wrote:Is that not allowed?


Here at CodeRanch we are fine with cross-posting, however we ask you to disclose this. Otherwise some people (who want to help you) might waste their time and effort answering a question that has already been answered. And that might cause a (very) big annoyance.
 
Poop goes in a willow feeder. Wipe with this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!