Webiondev123's avatar

How to rewriterule for localhost?

How can I rewriterule for localhost once I downloaded files from server?

this is what I need changed to localhost. This is now in server form

ewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/webmin
RewriteRule (.*) https://dev.boocak.com%{REQUEST_URI} [L,R=301]

I want localhost to land on index.php

0 likes
3 replies
rin4ik's avatar
  
    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
Webiondev123's avatar

Still not working

Heres my full .htaccess

AddType application/x-httpd-php .xml
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/webmin
RewriteRule (.*) https://dev.boocak.com%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/webmin
RewriteRule (.*) http://dev.boocak.com%{REQUEST_URI} [L,R=301]

RewriteRule ^webmin/$ webmin/index.php [L]

RewriteRule ^captcha/([^/]*)/([^/]*)/([^/]*)/$ CaptchaSecurityImages.php?width=&height=&characters= [L]
RewriteRule ^ajax/([^/]*)/$ ajax.php?action= [L]

RewriteRule ^listing-info-([^/]*)/([^/]*)/([^/]*)/$ product_info.php?name=&uid=&msg= [L]
RewriteRule ^listing-info-([^/]*)/([^/]*)/$ product_info.php?name=&uid= [L]
RewriteRule ^listing/([^/]*)/$ products.php?s= [L]
RewriteRule ^listing/$ products.php [L]

RewriteRule ^checkout/$ checkout.php [L]
RewriteRule ^checkout/step2/([^/]*)/$ checkout-step2.php?msg= [L]
RewriteRule ^checkout/step2/$ checkout-step2.php [L]
RewriteRule ^checkout/step3/$ checkout-step3.php [L]
RewriteRule ^checkout/process/$ checkout-process.php [L]
RewriteRule ^senangpay/$ senangpay-process.php [L]
RewriteRule ^thank-you/([^/]*)/$ checkout-complete.php?ON= [L]

RewriteRule ^login/([^/]*)/$ login.php?msg= [L]
RewriteRule ^login/$ login.php [L]
RewriteRule ^booking-details/$ booking-details.php [L]
RewriteRule ^booking-download/$ booking-download.php [L]

RewriteRule ^request-booking/([^/]*)/$ request-booking.php?msg= [L]
RewriteRule ^request-booking/$ request-booking.php [L]

RewriteRule ^([^/]*)/([^/]*)/$ content.php?pagename=&msg= [L]
RewriteRule ^([^/]*)/$ content.php?pagename= [L]

Addtype plain/text .xml

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName JustSimple

jlrdw's avatar

The one that came with laravel works as is:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
    RewriteBase /laravel55/

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]



    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

But note the added line:

RewriteBase /laravel55/

Change to your situation. This works on local and production.

Please or to participate in this conversation.