LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-20-2009, 08:08 AM   #1
ulver
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Rep: Reputation: 0
extensionless url with https redirect


Ok, I have a site and a backend.php interface which is in https. I make it with the following;

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On

  # force www if second level domain
  RewriteCond %{HTTP_HOST} ^([^\.]+)?\.([^\.]+)?$ [NC]
  RewriteRule .? http://www.%1.%2%{REQUEST_URI} [R=301,L]


 #https 
  RewriteCond %{REMOTE_ADDR} !^127\.[0-9]+\.[0-9]+\.[0-9]+$
  RewriteCond %{HTTPS} !=on
  RewriteCond %{REQUEST_URI} (.*/backen.*)
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]


</IfModule>

It works but I have just lost 5 hours trying to get extensionless php here so backend.php will read as backend or admin or whatever.

Anyone got any ideas please?
 
Old 01-20-2009, 04:08 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,938

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
You might take a look at this post in mod_rewrite forum.
 
Old 01-21-2009, 04:54 AM   #3
ulver
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Original Poster
Rep: Reputation: 0
success

Thank you, it works now

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  Options +FollowSymLinks +ExecCGI
  # force www if second level domain
  RewriteCond %{HTTP_HOST} ^([^\.]+)?\.([^\.]+)?$ [NC]
  RewriteRule .? http://www.%1.%2%{REQUEST_URI} [R=301,L]

  RewriteCond %{REMOTE_ADDR} !^127\.[0-9]+\.[0-9]+\.[0-9]+$
  RewriteCond %{HTTPS} !=on
  RewriteCond %{REQUEST_URI} (.*/backen.*)
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]

  # Remove the .php from PHP files (only files
  # that exist).
  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  RewriteCond %{SCRIPT_FILENAME} -f
  RewriteRule ^(.+)\.php$ /$1/ [R=301,L]

  # Rewrite /<name and /<name>/ to /<name>.php if
  # a PHP file exists and a directory does not.
  RewriteCond %{DOCUMENT_ROOT}/$1.php -f
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule ^(.*[^/])/?$ /$1.php [QSA,L]
 
  


Reply

Tags
apache, https, modrewrite, rewrite


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to redirect http to https? Sovan Linux - Server 1 12-03-2008 01:11 PM
redirect http to https awreneau Linux - Server 17 10-14-2008 09:13 AM
weird https redirect EmOuBi Linux - Desktop 0 07-17-2008 01:09 AM
redirect url munna_dude Linux - Software 2 02-15-2007 12:18 AM
url redirect Present Linux - Networking 4 01-26-2007 09:08 AM


All times are GMT -5. The time now is 08:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration