获取Mod重写重定向以显示在地址栏中

时间:2016-07-04 23:41:02

标签: apache .htaccess mod-rewrite url-redirection

我希望www.grabmegrub.com重定向到www.grabmegrub.com/page/calendar。此时它成功重定向用户并显示日历页面,但它不会更新地址栏。如何使地址栏显示www.grabmegrub.com/page/calendar

这里是代码,它位于根目录的.htaccess文件中:

RewriteEngine On
RewriteRule ^$ page/calendar

www.grabmegrub.com已上线。访问它,看看我在说什么。

2 个答案:

答案 0 :(得分:0)

const path = require('path'); const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ); const webpack = require ( 'webpack' ); const PATHS = { app: path.join( __dirname , 'src' ), build : path.join( __dirname , 'build' ) }; module.exports = { entry: { app: PATHS.app }, output: { path: PATHS.build, filename : '[name].js' }, devtool: 'source-map', module: { loaders: [{ test: /\.js$/, loader: 'babel-loader', query: { presets: ['es2015'] } }, { test: /\.ejs$/, loader: 'ejs-loader' }] }, resolve: { extensions: ['', '.js', '.json', 'ejs'] }, plugins: [ new HtmlWebpackPlugin({ template: path.join(PATHS.app, 'index.ejs') }), new webpack.ProvidePlugin({ _: "lodash" }) ] }; 指令的末尾添加R标志:

RewriteRule

答案 1 :(得分:0)

使用此:

RewriteEngine On
RewriteRule ^page/calendar$ / [L]

它应该提供您的网址:

www.grabmegrub.com/page/calendar