Jump to content

looking to ditch the .php extension


Derleek

Recommended Posts

yeah, mod_rewrite is the way to go. if you want a DIFFERENT extension, like .html pages running like PHP pages, that is something different though

 

You can mask php pages as html pages with mod_rewrite too... Though there are other ways of course.

Link to comment
Share on other sites

hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work?

 

Yes it will still work. it is simply a way to have apache map one url to another. eg;

 

http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar

Link to comment
Share on other sites

hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work?

 

Yes it will still work. it is simply a way to have apache map one url to another. eg;

 

http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar

 

Yes that makes sense, but ... how does apache know the difference between something it needs to "map" opposed to accessing a file called "bar" in directory "foo".

Link to comment
Share on other sites

hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work?

 

Yes it will still work. it is simply a way to have apache map one url to another. eg;

 

http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar

 

Yes that makes sense, but ... how does apache know the difference between something it needs to "map" opposed to accessing a file called "bar" in directory "foo".

You'd do this by setting up a rewrite conditions to check to see if the requested url is not a existing file/directory, example

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# your RewriteRule's continue here

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.