I have following rewrite rule in htaccess and its not working for first part for EventList.php. Will appreciate some help to figure out whats wrong. I am adding this in a wordpress website htaccess file.
RewriteEngine On
RewriteRule ^Local-Event/([0-9]*)$ /Eventbrite.php?page=$1 [QSA]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Related
I created a virtualhost with MAMP. It works well when I go to example.dev. I just installed a wordpress on example.dev without any problems. When I display a page or a post, there is a /index.php which is added before the page name. For example : example.dev/index.php/pagename.
I can not access example.dev/pagename, i have a 404 error.
In permalink's options, it generates automatically /index.php/%year%/%monthnum%/%day%/%postname%/.
I selected http://example.dev/example-article/ but it is still not working.
I have a htaccess at the root
RewriteEngine On
# 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
If somebody has an idea...
Thank you !!
To this url /index.php/%year%/%monthnum%/%day%/%postname%/ will work on Apache server add this rule to .htaccess file
RewriteRule ^index.php/(.*)/?$ /$1/ [L]
Above the WordPress rules:
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Given that your .htaccess have the basic WordPress rules it would look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php/(.*)/?$ /$1/ [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
END WordPress
I'm trying to add a custom rewrite rule for my WP site so http://example.com/?u=sample-output, is rewritten as http://example.com/sample-output.
The rewrite rule I'm trying to add is:
RewriteEngine On
RewriteRule ^([^/]*)$ /?u=$1 [L]
The existing rewrite rule is:
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
When I add it in, it gives me a 404 error when I visit the page. I'm guessing this is because of a conflict. Any suggestions on how to fix this would be greatly appreciated.
Based on your comments, put the rule above the WP rules and then you can do something like this. And all URLs that will go to the query string would have to use /start/ in it. Then make sure to ignore /start/ in the WP rules like below for all others.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^start/([^/]+)/?$ /?u=$1 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/start [NC]
RewriteRule . /index.php [L]
I moved a Wordpress blog from blog.mywebsite.com to mywebsite.com/blog/ .
Everything was OK until I tried to redirect old links to the new location.
I want people asking http://blog.mywebsite.com/2014/09/article-example/ to find themselves in http://mywebsite.com/blog/2014/09/article-example/
But the htaccess is already completed with some rules using the keyword "blog"
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
I cannot find the way to write the rule
Today I have an error 500 with this link : http://blog.mywebsite.com/2014/09/article-example/
I would like at least to redirect to mywebsite.com/blog/ , ideally to http://mywebsite.com/blog/2014/09/article-example/
Any idea?
Thanks and good day everyone :)
You can replace your current htaccess code by this one
RewriteEngine On
RewriteBase /blog/
RewriteCond %{HTTP_HOST} ^blog\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/blog/$1 [R=301,L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
I'm hoping you guys can help me out. I want to rename my theme's CSS & JS path but I can't seem to figure it out.
For example:
I want to change:
http://cdn.(domain-name).com/wp-content/themes/smart-mag/style.css
to
http://cdn.(domain-name).com/style.css
& from:
http://cdn.(domain-name).com/wp-content/themes/smart-mag/js/bunyad-theme.js
to
http://cdn.(domain-name).com/js/bunyad-theme.js
etc, etc.
Here is what I tried in my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^wp-content/themes/smart-mag/screenshot\.png|readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$ /nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
RewriteCond %{REQUEST_URI} \.(css|js|jpe?g|gif|png|bmp)$
RewriteCond %{REQUEST_URI} !^/themes/smart-mag/
RewriteRule ^(.*) /themes/smart-mag/$1 [L]
</IfModule>
#END WordPress
That modified htaccess did nothing at all. What am I missing/doing wrong here?
You need to change the order of your rules. The wordpress rules route all requests to index.php, including your /style.css etc URLs. So you need to route those first.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} \.(css|js|jpe?g|gif|png|bmp)$
RewriteCond %{REQUEST_URI} !^/themes/smart-mag/
RewriteRule ^(.*) /themes/smart-mag/$1 [L]
RewriteRule ^index\.php$ - [L]
RewriteRule ^wp-content/themes/smart-mag/screenshot\.png|readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$ /nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
#END WordPress
We are trying to make a change of domain for a wordpress.
The blog is in a subfolder called "blog".
The old domain is
http://www.peluches-et-jouets-en-bois.fr/blog
We want all the pages of the blog to be redirected to :
http://www.peluchesetjouetsenbois.fr/blog
It does work for the home page of the blog, but as soon as we go to another page of the blog, then it doesn't work anymore.
Here is what we have so far.
WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
RewriteCond %{HTTP_HOST} ^(www\.)?peluches-et-jouets-en-bois.fr$
RewriteRule ^(.*)$ http://www.peluchesetjouetsenbois.fr/blog/$1 [L,R=301]
</IfModule>
# END Wo
If someone can help us on that, that would be great :)
Thanks a lot
Place redirection rule before existing WP rules:
RewriteEngine On
RewriteBase /blog/
RewriteCond %{HTTP_HOST} ^(www\.)?peluches-et-jouets-en-bois\.fr$ [NC]
RewriteRule ^(.*)$ http://www.peluchesetjouetsenbois.fr/blog/$1 [L,NE,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]