in Education by
I have laravel website and there is blog folder which contain wordpress blog. In my htaccess I want some path that allow to open otherwise redirect on home. So my post preview link also redirect on home page. I want to stop it. Preview link is like https://www.test.com/?p=16286. I want to redirect on particular page. Below is my htaccess code RewriteEngine on RewriteCond %{REQUEST_URI} !/my-form RewriteCond %{REQUEST_URI} !/save_subscribe_user RewriteCond %{REQUEST_URI} !/demo RewriteCond %{REQUEST_URI} !/xamarin-app-development RewriteCond %{REQUEST_URI} !/xamarin-app-development-inner RewriteCond %{REQUEST_URI} !/web-and-mobile-app-development RewriteCond $1 !^(blog|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ blog/$1 [L,QSA] ## EXPIRES CACHING ## AddHandler application/x-httpd-php .js ## EXPIRES CACHING ## Options -MultiViews -Indexes 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] #This line added to allow blog in URL and allow routing through Laravel RewriteCond %{REQUEST_URI} !^/blog/ #Blog post preview URL RewriteCond %{QUERY_STRING} ^p=([0-9]*) RewriteRule ^ http://www.test.com/?p=%1&preview=true [R=301,L] Run code snippetExpand snippet JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
These two lines : RewriteCond %{QUERY_STRING} ^p=([0-9]*) RewriteRule ^ http://www.test.com/?p=%1&preview=true [R=301,L] The query string is start with numerical value as the target you need to redirect to so , it will be rewritied more and more and you could be more specific , as you menthioned in quistion , by add $ to ^p=([0-9]*)$ to be sperated from the new one . change your rules like this : RewriteCond %{QUERY_STRING} ^p=([0-9]*)$ RewriteRule ^ http://www.test.com/?p=%1&preview=true [R=301,L] If that not ok and you need to match this query string before any rewriting rule just put it up before that particulaar step. Note: clear browser cache then test

Related questions

0 votes
    I have created a custom post type in wordpress called videos. When the admin adds a video he also ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I'm hosting a wordpress site on ec2 and I'm trying to update my theme through the admin screen. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I am using wordpress, and some pages are using page-template, which is almost full HTML without . Now ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    How to sort wordpress results by category or taxonomy? I have this code: function ordenarResultados($query) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I'm using the new wordpress custom post types and fields. It's all working great, but for a custom image field (where ... below, the final code for anybody who needs it is this:...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I'm using the new wordpress custom post types and fields. It's all working great, but for a custom image field (where ... below, the final code for anybody who needs it is this:...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    If I want to hold a Teams meeting and invite “guests,” what happens if I select that only specific domains ... still able to join the Teams meeting from via a link?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    I want to create a request from my application. (iOS and Android - Coded with Xamarin). Explaination: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    ___option in word changes the structure and layout of pages . 1. format 2. page setup 3. print and print preview 4. Proofing Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    I will be using Wordpress as a CMS with custom post types. Each "post" is a product and will ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    I am facing an wiered problem while adding new Page in the wordpress. Steps: Create a new page with ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    i have online Wordpress blog, now i copied my blog to localhost to change the design. I replaced http ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    State T' for true and F' for false statements: 1. Home button is used to display the home page. 2. ... be used to pay bills. Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    Does it cover silver or golden ornaments if I have ‘Home insurance’?...
asked Dec 31, 2020 in Health by Editorial Staff
0 votes
    Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
...