change url #firstPage with htaccess - .htaccess

I use the fullpage plugin (from https://alvarotrigo.com/fullPage/ ) in wordpress but I want to delete #firstPage in the url but use the buttons so I can't use the noAnchor (https://alvarotrigo.com/fullPage/examples/noAnchor.html). can I rewrite the URL with htaccess? something like this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php/#firstPage$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
http://www.example.com/#firstPage/1

If you don't want anchors in the URL, don't use anchors in the fullPage.js initialisation.
Then bind the moveTo method to your menu elements.

Related

Mod Rewrite rule for pagiantion

My home page url is
http://example.com/subsite
My pagination hover link shows
http://example.com/subsite/?page=2
but it redirects back to http://example.com/subsite
whereas it should show and also go to http://example.com/subsite/page/2 which works (if i try manually). Here is my htaccess file looks like,
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subsite/index.php [L]
</IfModule>
How to fix the pagination rewrite rule?

All menu items redirect to homepage .htaccess

I have the following webpage in Pligg CMS under the following url
http://africafreak.com/
I don't know why but every Menu item redirects to the Main Page. Here is my .htacess file
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
<IfModule mod_rewrite.c>
RewriteEngine On RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
What seems to be the problem? Any help will be appreciated.

.htaccess syntax redirect one domain to another without matching?

What I'm looking to do:
Redirect example.com/(any-number) to example2.com/landing-page
example.com/(any-number) has hundreds of articles all of which end in a number. I'm not looking to match the number on my other site so much as direct people to a single landing page.
Current htaccess looks like this:
`# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress`
Try adding:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^my-site\.com$ [NC]
RewriteRule ^([0-9]+)$ http://my-other-site.com/landing-page [L,R=301]
In the htaccess file in the document root of the "my-site.com" site.

htaccess rewrite rule blog links

I have been using htaccess to remove rewrite certain URLs, however I am looking at something a little more complicated at the moment.
Our website blog (WordPress) used to have links like this:
​/blog​/postname/1387
However after redoing the website our links are now currently just
/postname
Would it be possible to redirect any uses from ​/blog​/postname/1387 and get rid of the blog and number at the end via htaccess so it just contains the postname? At the moment I have:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^blog/(.*)/.*$ $1/
</IfModule>
Would love to hear any hints or tips, as this is not actually doing any redirecting, what am I doing wrong?
Let's just do a little cleanup:
<IfModule mod_rewrite.c>
#Turn on the RewriteEngine
RewriteEngine On
#Rewrites are all relative to /
RewriteBase /
#Explicit - If the request is for index.php, do nothing.
RewriteRule ^index\.php$ - [L]
#Conditional – Unless the file or directory specifically exists,
#If the request is for the old style blog URI, redirect to new style and stop.
#Otherwise, redirect to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)/.*$ $1/ [R=301,L,QSA]
RewriteRule . /index.php [L]
</IfModule>

Rewrite GET Variable in URL

I am using WordPress's permalink structure %category%/%postname%/ with the following htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
The url's take the form http://www.example.com/category/postname/. I have a plugin where if you append ?m=gallery to the URL it will bring you to the posts' gallery. So http://www.example.com/category/postname/?m=gallery brings you to the gallery. I would like to be able to use http://www.example.com/category/postname/gallery/ instead. What do I need to modify in my htaccss to achieve my desired results? I would imagine it would be something like this RewriteRule ^(.+)/gallery$ $1?m=gallery
Edit - Current htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^(.+)/gallery/$ $1/?m=gallery [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Considering URL example you have provided (http://www.example.com/category/postname/gallery/ => http://www.example.com/category/postname/?m=gallery) you will need this sort of line:
RewriteRule ^(.+)/gallery/$ $1/?m=gallery [QSA]
Added missing slashes /
Added [QSA] flag (may not be really necessary actually).
You would need to put this rule somewhere on the top: after this line, for example: RewriteRule ^index\.php$ - [L]
Obviously, you ensure that WordPress will generate this kind of URLs: http://www.example.com/category/postname/gallery/

Resources