I have a domain tradebazaars.com I have put the rules to redirect it to https and want the subdomains to be redirect to https as well. Now this is working but for the sub domain i don't want the www added to the url where as i want the same to be added to the main domain. I am using Laravel framework for my project and I have only one setup of the code, don't have multiple setups installed for both main and sub domain. I have separated them with group routing, specifying the domain for routes. Please help me to resolve this issue.
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# redirect no-www to www only main domain, not with subdomain
RewriteCond %{HTTP_HOST} ^(tradebazaars\.com)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# redirect http to https all domain
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# 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>
# Prevent viewing of htaccess file.
<Files .htaccess>
order allow,deny
deny from all
</Files>
# BEGIN DEFLATE COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule>
# END DEFLATE COMPRESSION
# BEGIN GZIP COMPRESSION
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
# END GZIP COMPRESSION
#BEGIN EXPIRES HEADERS
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
# Webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</IfModule>
#END EXPIRES HEADERS
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# END Cache-Control Headers
Laravel Routes File
Route::group(['domain' => 'https://seller.tradebazaars.com'], function () {
//Login
Route::any('/', ['uses' => 'Frontend\Seller\Login\LoginController@getLogin', 'as' => 'sellerhomelogin']);
Route::any('/sellerlogin', ['uses' => 'Frontend\Seller\Login\LoginController@ProcessLogin', 'as' => 'sellerlogin']);
Route::any('/sellerlogout', ['uses' => 'Frontend\Seller\Login\LoginController@SellerLogout', 'as' => 'sellerlogout']);
Route::any('/seller-signup', ['uses' => 'Frontend\Seller\Login\LoginController@getRegistration', 'as' => 'seller-signup']);
Route::any('/sellerregister', ['uses' => 'Frontend\Seller\Login\LoginController@SellerRegistration', 'as' => 'sellerregister']);
Route::any('/seller-verify/{email}/{token}', ['uses' => 'Frontend\Seller\Login\LoginController@SellerVerification', 'as' => 'seller-verify']);
Route::any('/seller-verify-complete', ['uses' => 'Frontend\Seller\Login\LoginController@SellerVerifiyComplete', 'as' => 'seller-verify-complete']);
Route::any('/seller-check-storename', ['uses' => 'Frontend\Seller\Login\LoginController@CheckStoreName', 'as' => 'seller-check-storename']);
Route::any('/seller-check-filetype', ['uses' => 'Frontend\Seller\Login\LoginController@CheckFileType', 'as' => 'seller-check-filetype']);
Route::any('/seller-check-useremail', ['uses' => 'Frontend\Seller\Login\LoginController@CheckUserEmail', 'as' => 'seller-check-useremail']);
Route::any('/seller-check-usermobile', ['uses' => 'Frontend\Seller\Login\LoginController@CheckUserMobile', 'as' => 'seller-check-usermobile']);
//Dashboard
Route::any('/seller-dashboard', ['uses' => 'Frontend\Seller\Dashboard\DashboardController@GetIndex', 'as' => 'seller-dashboard']);
//Orders and returns
Route::any('/seller-orders', ['uses' => 'Frontend\Seller\Orders\OrderController@GetOrders', 'as' => 'seller-orders']);
Route::any('/seller-view-order/{id}', ['uses' => 'Frontend\Seller\Orders\OrderController@ViewOrder', 'as' => 'seller-view-order']);
Route::any('/seller-delete-order', ['uses' => 'Frontend\Seller\Orders\OrderController@DeleteOrder', 'as' => 'seller-delete-order']);
Route::any('/seller-get-order-status', ['uses' => 'Frontend\Seller\Orders\OrderController@GetOrderStatus', 'as' => 'seller-get-order-status']);
Route::any('/seller-change-order-status', ['uses' => 'Frontend\Seller\Orders\OrderController@UpdateGetOrderStatus', 'as' => 'seller-change-order-status']);
});
//Main Domain
Route::group(['domain' => 'https://www.tradebazaars.com'], function () {
//Admin Panel
Route::group(['prefix' => 'masterpanel', 'middleware' => 'masterpanel'], function() {
//login
Route::any('/', ['uses' => 'Admin\LoginController@getLogin', 'as' => 'loginadmin']);
Route::any('processlogin', ['uses' => 'Admin\LoginController@doLogin', 'as' => 'processlogin']);
Route::any('/logout', ['uses' => 'Admin\LoginController@logout', 'as' => 'logout']);
//dashboard
Route::any('dashboard', ['uses' => 'Admin\DashboardController@getDashboard', 'as' => 'dashboard']);
/********** Brand **********/
Route::any('/brand', ['uses' => 'Brand\BrandController@ManageBrand', 'as' => 'brand']);
Route::any('/savebrand', ['uses' => 'Brand\BrandController@SaveBrand', 'as' => 'savebrand']);
Route::any('/viewbrand/{id}', ['uses' => 'Brand\BrandController@ViewBrand', 'as' => 'viewbrand']);
Route::any('/editbrand/{id}', ['uses' => 'Brand\BrandController@EditBrand', 'as' => 'editbrand']);
Route::any('/updatebrand', ['uses' => 'Brand\BrandController@UpdateBrand', 'as' => 'updatebrand']);
Route::any('/deletebrand', ['uses' => 'Brand\BrandController@DeleteBrand', 'as' => 'deletebrand']);
Route::any('/importbrand', ['uses' => 'Brand\BrandController@ImportBrand', 'as' => 'importbrand']);
Route::any('/exportbrand', ['uses' => 'Brand\BrandController@ExportBrand', 'as' => 'exportbrand']);
Route::any('/deleteselectedbrand', ['uses' => 'Brand\BrandController@DeleteSelectedBrand', 'as' => 'deleteselectedbrand']);
Route::any('/deleteallbrand', ['uses' => 'Brand\BrandController@DeleteAllBrand', 'as' => 'deleteallbrand']);
Route::any('/brandspagegetdtdata', ['uses' => 'Brand\BrandController@GetProductsDTData', 'as' => 'brandspagegetdtdata']);
/********** Product Type **********/
Route::any('/addproducttype', ['uses' => 'ProductType\ProductTypeController@AddProductType', 'as' => 'addproducttype']);
Route::any('/saveproducttype', ['uses' => 'ProductType\ProductTypeController@SaveProductType', 'as' => 'saveproducttype']);
Route::any('/manageproducttype', ['uses' => 'ProductType\ProductTypeController@ManageProductType', 'as' => 'manageproducttype']);
Route::any('/editproducttype/{id}', ['uses' => 'ProductType\ProductTypeController@EditProductType', 'as' => 'editproducttype']);
Route::any('/updateproducttype', ['uses' => 'ProductType\ProductTypeController@UpdateProductType', 'as' => 'updateproducttype']);
Route::any('/deleteproducttype', ['uses' => 'ProductType\ProductTypeController@DeleteProductType', 'as' => 'deleteproducttype']);
Route::any('/deleteselectedproducttype', ['uses' => 'ProductType\ProductTypeController@DeleteSelectedRecords', 'as' => 'deleteselectedproducttype']);
/********** Category **********/
//Category
Route::any('/category', ['uses' => 'Category\CategoryController@ManageCategory', 'as' => 'category']);
Route::any('/savecategory', ['uses' => 'Category\CategoryController@SaveCategory', 'as' => 'savecategory']);
Route::any('/viewcategory/{id}', ['uses' => 'Category\CategoryController@ViewCategory', 'as' => 'viewcategory']);
Route::any('/editcategory/{id}', ['uses' => 'Category\CategoryController@EditCategory', 'as' => 'editcategory']);
Route::any('/updatecategory', ['uses' => 'Category\CategoryController@UpdateCategory', 'as' => 'updatecategory']);
Route::any('/deletecategory', ['uses' => 'Category\CategoryController@DeleteCategory', 'as' => 'deletecategory']);
Route::any('/deleteselectedcategorylvl1', ['uses' => 'Category\CategoryController@DeleteSelectedCategoryLvl1', 'as' => 'deleteselectedcategorylvl1']);
Route::any('/category-level-getdttable', ['uses' => 'Category\CategoryController@GetTableDetails', 'as' => 'category-level-getdttable']);
});
//Frontend
Route::any('/', ['uses' => 'Frontend\Pages\HomeController@GetIndex', 'as' => 'fronthome']);
Route::any('/binfo-save-details', ['uses' => 'Users\NormalUserManageController@SaveBinfoDetails', 'as' => 'binfo-save-details']);
Route::any('/binfo-get-city', ['uses' => 'Users\NormalUserManageController@GetCityFromStateID', 'as' => 'binfo-get-city']);
Route::any('/top-search', ['uses' => 'Frontend\Pages\HomeController@SearchSite', 'as' => 'top-search']);
Route::any('/search/{keyword}', ['uses' => 'Frontend\Pages\HomeController@GetSearchPage', 'as' => 'search']);
Route::any('/convert-to-slug', ['uses' => 'Frontend\Pages\HomeController@CreateSugFromName', 'as' => 'convert-to-slug']);
//Route::any('/{page}', ['uses' => 'GeneralPurpose\SiteRedirectController@GetPage', 'as'=> 'page']);
Route::any('/{page}', ['uses' => 'GeneralPurpose\SiteRedirectController@GetPage', 'as'=> 'page']);
Route::any('/{page}/{sku}', ['uses' => 'GeneralPurpose\SiteRedirectController@GetSingleProductPage', 'as'=> 'page']);
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire