• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WAMP automatically adds .php extension to file with RewriteRule

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question was cross-posted on StackOverflow.
 
Barry Deman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic